/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = 'regional';
  
  checkConfig(config);
  @endpoint = getEndpoint('airec', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model ExtraDataSource {
  dataSourceId?: string(name='DataSourceId', example='E01D574F-ABD0-4C55-A5E3-8D24FD8D42EA'),
  gmtCreate?: string(name='GmtCreate', example='2021-12-07T13:26:29.000Z'),
  gmtModified?: string(name='GmtModified', example='2021-12-07T13:26:29.000Z'),
  meta?: {
    internal?: boolean(name='Internal', example='true'),
    metaType?: string(name='MetaType', example='ExtraDataSource'),
    projectName?: string(name='ProjectName', example='test_project'),
    tableName?: string(name='TableName', example='test_table'),
    type?: string(name='Type', example='ODPS'),
    updateFrequency?: long(name='UpdateFrequency', example='86400'),
  }(name='Meta'),
  status?: string(name='Status', example='Ready 待应用；Online 已应用；Failed失败'),
  type?: string(name='Type', example='UserCustomDataSource、ItemCustomDataSource、BehaviorCustomDataSource、SampleCustomDataSource'),
}

model FeatureTable {
  featureTableId?: string(name='FeatureTableId', example='30E70118-FC7C-4438-9287-583CE47266A9'),
  gmtCreate?: string(name='GmtCreate', example='2021-12-10T02:59:54.000Z'),
  gmtModified?: string(name='GmtModified', example='2021-12-10T02:59:54.000Z'),
  meta?: {
    dataSourceId?: string(name='DataSourceId', example='907648f5-abae-44fd-a4c4-525cc25947e9'),
    featureList?: [ 
      {
        comment?: string(name='Comment', example='com11'),
        featureName?: string(name='FeatureName', example='fn11'),
        fieldName?: string(name='FieldName', example='fieldName11'),
        status?: string(name='Status', example='NotApplied 未应用 Applied 已应用'),
      }
    ](name='FeatureList'),
    internal?: boolean(name='Internal', example='true'),
    metaType?: string(name='MetaType', example='FeatureTable'),
    source?: string(name='Source', example='test_project.test_table'),
    updateFrequency?: long(name='UpdateFrequency', example='86400'),
  }(name='Meta'),
  status?: string(name='Status'),
  type?: string(name='Type', example='ItemFeatureTable 物品特征表 UserFeatureTable 用户特征表'),
}

model RankingModelTemplate {
  meta?: {
    authorized?: boolean(name='Authorized', example='true'),
    autoRun?: boolean(name='AutoRun', example='true'),
    autoRunTime?: long(name='AutoRunTime', example='1'),
    autoRunType?: string(name='AutoRunType', example='DAY'),
    canDeploy?: boolean(name='CanDeploy', example='true'),
    conf?: string(name='Conf', example='train_config {}'),
    deployStatus?: string(name='DeployStatus', example='NOT_DEPLOYED'),
    lastEditTime?: string(name='LastEditTime', example='2021-12-06T03:01:41.217Z'),
    name?: string(name='Name', example='模型A'),
    ossArn?: string(name='OssArn', example='acs:ram::111:role/aliyunodpspaidefaultrole'),
    ossBucket?: string(name='OssBucket', example='bucket-a'),
    ossEndpoint?: string(name='OssEndpoint', example='oss-cn-beijing.aliyuncs.com'),
    sampleId?: string(name='SampleId', example='1111'),
    sampleName?: string(name='SampleName', example='样本1'),
    sampleTimeWindow?: long(name='SampleTimeWindow', example='3'),
    sampleTimeWindowType?: string(name='SampleTimeWindowType', example='DAY'),
    type?: string(name='Type', example='MULTI_TOWER'),
  }(name='Meta'),
  status?: string(name='Status', example='TRAINING_SUCCESS'),
  templateId?: string(name='TemplateId', example='a-a-a'),
  versionNum?: long(name='VersionNum', example='3'),
}

model RankingModelVersion {
  name?: string(name='Name', example='模型A_t1638964800000'),
  runLog?: string(name='RunLog'),
  runResult?: {
    assessAuc?: string(name='AssessAuc', example='0.3'),
    assessGauc?: string(name='AssessGauc', example='0.3'),
    assessLoss?: string(name='AssessLoss', example='0.3'),
    trainAuc?: string(name='TrainAuc', example='0.3'),
    trainGauc?: string(name='TrainGauc', example='0.3'),
    trainLoss?: string(name='TrainLoss', example='0.3'),
  }(name='RunResult'),
  runTime?: string(name='RunTime', example='2021-12-08T20:00:00.0Z'),
  status?: string(name='Status', example='TRAINING'),
  templateId?: string(name='TemplateId', example='a-a-a'),
  templateName?: string(name='TemplateName', example='模型A'),
}

model RankingSystem {
  applyStatus?: string(name='ApplyStatus', example='NOT_APPLIED'),
  deployStatus?: string(name='DeployStatus', example='NOT_DEPLOYED'),
  meta?: {
    autoDeploy?: boolean(name='AutoDeploy', example='true'),
    autoDeployAuc?: string(name='AutoDeployAuc', example='0.3'),
    conf?: string(name='Conf'),
    failMsg?: string(name='FailMsg'),
    modelVersionName?: string(name='ModelVersionName', example='模型A_T1638964800000'),
    predictEngine?: {
      clusterId?: string(name='ClusterId', example='cn-shanghai'),
      resourceId?: string(name='ResourceId', example='eas-oljkkdrggxhx7eizjd'),
      version?: string(name='Version', example='1'),
    }(name='PredictEngine'),
    predictEngineType?: string(name='PredictEngineType', example='EAS'),
  }(name='Meta'),
  modelTemplateId?: string(name='ModelTemplateId', example='a-a-a'),
  name?: string(name='Name', example='servicea'),
  sceneIdList?: [ long ](name='SceneIdList'),
}

model RankingSystemHistory {
  meta?: {
    autoDeploy?: boolean(name='AutoDeploy', example='true'),
    autoDeployAuc?: string(name='AutoDeployAuc', example='0.3'),
    conf?: string(name='Conf'),
    modelTemplateName?: string(name='ModelTemplateName', example='排序模型A'),
    predictEngine?: {
      resourceId?: string(name='ResourceId', example='eas-oljkkdrggxhx7eizjd'),
      version?: string(name='Version', example='1'),
    }(name='PredictEngine'),
    predictEngineType?: string(name='PredictEngineType', example='EAS'),
    previousOperateId?: string(name='PreviousOperateId', example='aaaa'),
  }(name='Meta'),
  name?: string(name='Name', example='servicea'),
  operateId?: string(name='OperateId', example='8AC865AF-37D6-42ED-AA9A-B60D8ECDF640'),
  operateTime?: string(name='OperateTime', example='2021-12-06T03:01:41.217Z'),
  operateType?: string(name='OperateType', example='CONF_CHANGE'),
}

model Sample {
  gmtCreate?: string(name='GmtCreate', example='2021-12-07T12:28:52.000Z'),
  gmtModified?: string(name='GmtModified', example='2021-12-07T12:28:52.000Z'),
  meta?: {
    autoUpdate?: boolean(name='AutoUpdate', example='true'),
    autoUpdateFrequency?: long(name='AutoUpdateFrequency', example='86400'),
    clonedId?: string(name='ClonedId', example='1638877561147'),
    config?: {
      bhvTableSourceIds?: [ string ](name='BhvTableSourceIds'),
      featureConfig?: {
        itemFeatures?: string(name='ItemFeatures', example='物品特征，支持多值，逗号分隔。'),
        userFeatures?: string(name='UserFeatures', example='用户特征，支持多值，逗号分隔。'),
      }(name='FeatureConfig'),
      labelLogic?: {
        bhvTimeWindow?: long(name='BhvTimeWindow', example='86400'),
        negativeBhvTypes?: string(name='NegativeBhvTypes', example='click,expose'),
        positiveBhvTypes?: string(name='PositiveBhvTypes', example='like'),
      }(name='LabelLogic'),
      weightLogicList?: [ 
        {
          bhv?: string(name='Bhv', example='click'),
          weight?: string(name='Weight', example='1.01'),
        }
      ](name='WeightLogicList'),
    }(name='Config'),
    extendParams?: {
      latestTaskStatus?: long(name='LatestTaskStatus', example='0 没有任务 1 正常 2 异常'),
      sampleCount?: long(name='SampleCount', example='0'),
    }(name='ExtendParams'),
    metaType?: string(name='MetaType', example='Sample'),
    name?: string(name='Name', example='12345'),
    storeConfig?: string(name='StoreConfig', example='projectName.tableName'),
    type?: string(name='Type', example='Cloned 复制的 System 系统的 Custom 自定义的'),
  }(name='Meta'),
  sampleId?: string(name='SampleId', example='1638880131873'),
  status?: string(name='Status', example='样本状态 Unready 未完成配置  Ready   配置完成  Generating 样本生成中  Success  样本生成成功  Failed 样本生成失败  Formatting 格式化中  Formatted 格式化完成  FormatFailed 格式化失败  Applied 已应用到模型中'),
}

model AttachDatasetResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the request.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: long(name='gmtCreate', description='The time when the data source was created.', example='1544112000000'),
    gmtModified?: long(name='gmtModified', description='The time when the data source was last modified.', example='1544112000000'),
    instanceId?: string(name='instanceId', description='The ID of the instance.', example='airec-cn-o400whm78004'),
    state?: string(name='state', description='The state for the dataset of the current version. Example: Importing. The value indicates that the dataset of the current version is being imported.', example='Importing'),
    versionId?: string(name='versionId', description='The version number of the dataset.', example='20181023214546'),
  }(name='result', description='The details about the dataset.'),
}

model AttachDatasetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AttachDatasetResponseBody(name='body'),
}

/**
 * @summary Uses a dataset of a specified version of a specified instance to provide online services.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AttachDatasetResponse
 */
async function attachDatasetWithOptions(instanceId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): AttachDatasetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'AttachDataset',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSets/${OpenApiUtil.getEncodeParam(versionId)}/actions/current`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Uses a dataset of a specified version of a specified instance to provide online services.
 *
 * @return AttachDatasetResponse
 */
async function attachDataset(instanceId: string, versionId: string): AttachDatasetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return attachDatasetWithOptions(instanceId, versionId, headers, runtime);
}

model AttachIndexVersionResponseBody = {
  requestId?: string(name='requestId', example='E63A27A4-3411-4910-B7D5-12EEAC19389B'),
  result?: boolean(name='result', example='true'),
}

model AttachIndexVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: AttachIndexVersionResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return AttachIndexVersionResponse
 */
async function attachIndexVersionWithOptions(instanceId: string, algorithmId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): AttachIndexVersionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'AttachIndexVersion',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/index-versions/${OpenApiUtil.getEncodeParam(versionId)}/actions/attach`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return AttachIndexVersionResponse
 */
async function attachIndexVersion(instanceId: string, algorithmId: string, versionId: string): AttachIndexVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return attachIndexVersionWithOptions(instanceId, algorithmId, versionId, headers, runtime);
}

model CheckRankingModelReachableResponseBody = {
  code?: string(name='code', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: boolean(name='result', description='The returned result.', example='true'),
}

model CheckRankingModelReachableResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CheckRankingModelReachableResponseBody(name='body'),
}

/**
 * @summary Checks the network connectivity of a ranking model.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CheckRankingModelReachableResponse
 */
async function checkRankingModelReachableWithOptions(instanceId: string, rankingModelId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CheckRankingModelReachableResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CheckRankingModelReachable',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-models/${OpenApiUtil.getEncodeParam(rankingModelId)}/actions/check-connectivity`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Checks the network connectivity of a ranking model.
 *
 * @return CheckRankingModelReachableResponse
 */
async function checkRankingModelReachable(instanceId: string, rankingModelId: string): CheckRankingModelReachableResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return checkRankingModelReachableWithOptions(instanceId, rankingModelId, headers, runtime);
}

model CloneExperimentRequest {
  dryRun?: boolean(name='dryRun', description='true: verifies experiment information. false (default): creates an experiment.', example='false'),
}

model CloneExperimentResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: {
    algorithms?: [ 
      {
        category?: string(name='category', description='The algorithm category. Valid values: RECALL and RANK.', example='RECALL'),
        config?: [ 
          {
            defaultValue?: string(name='defaultValue', description='The default value of the algorithm.', example='400'),
            experimentValue?: string(name='experimentValue', description='The custom value of the algorithm.', example='swing;commoni2i;pcategory;scategory'),
            key?: string(name='key', description='The algorithm key.', example='I2I-truncedquantity'),
            name?: string(name='name', description='The algorithm name. (Note: If you use the default algorithm, the console obtains the algorithm name from Medusa. If you customize an algorithm for the experiment, the algorithm name is directly returned.)'),
          }
        ](name='config', description='The child configuration items.'),
        defaultValue?: string(name='defaultValue', description='The default value of the algorithm configuration item.', example='i2i;u2x2i;new;hot;embedding;embedding'),
        experimentValue?: string(name='experimentValue', description='The custom value of the algorithm configuration item.', example='300'),
        hasConfig?: boolean(name='hasConfig', description='Indicates whether child configuration items exist. Valid values: true and false.', example='true'),
        key?: string(name='key', description='The algorithm key. Valid values: I2I: the I2I filtering algorithm. u2X2I: the U2X2I filtering algorithm. hot: the filtering algorithm for popular items. new: the filtering algorithm for new items. embedding: the vector filtering algorithm. mtorder: the priority of the filtering algorithm. rankservice: the ranking service.', example='I2I'),
        name?: string(name='name', description='The algorithm name. (Note: If you use the default algorithm, the console obtains the algorithm name from Medusa. If you customize an algorithm for the experiment, the algorithm name is directly returned.)', example='name'),
        type?: string(name='type', description='The algorithm type. Valid values: SYSTEM and CUSTOM.', example='SYSTEM'),
      }
    ](name='algorithms', description='The algorithm configurations.'),
    base?: boolean(name='base', description='N/A', example='true'),
    buckets?: [ string ](name='buckets', description='The buckets.'),
    description?: string(name='description', description='The remarks.', example='xxx'),
    experimentId?: string(name='experimentId', description='The experiment ID.', example='12345'),
    name?: string(name='name', description='The experiment name.', example='xxx'),
    offlineTime?: string(name='offlineTime', description='The time when the experiment was unpublished.', example='2020-11-11T09:47:43.000Z'),
    onlineTime?: string(name='onlineTime', description='The time when the experiment was published.', example='2020-11-11T09:47:43.000Z'),
    status?: string(name='status', description='The experiment state.', example='Init'),
  }(name='result', description='The information about the experiment.'),
}

model CloneExperimentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CloneExperimentResponseBody(name='body'),
}

/**
 * @summary Clones an experiment.
 *
 * @param request CloneExperimentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CloneExperimentResponse
 */
async function cloneExperimentWithOptions(instanceId: string, sceneId: string, experimentId: string, request: CloneExperimentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CloneExperimentResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CloneExperiment',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments/${OpenApiUtil.getEncodeParam(experimentId)}/actions/clone`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Clones an experiment.
 *
 * @param request CloneExperimentRequest
 * @return CloneExperimentResponse
 */
async function cloneExperiment(instanceId: string, sceneId: string, experimentId: string, request: CloneExperimentRequest): CloneExperimentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cloneExperimentWithOptions(instanceId, sceneId, experimentId, request, headers, runtime);
}

model CloneSampleResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: Sample(name='result', description='The returned result.'),
}

model CloneSampleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CloneSampleResponseBody(name='body'),
}

/**
 * @summary Clones a sample.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CloneSampleResponse
 */
async function cloneSampleWithOptions(instanceId: string, sampleId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CloneSampleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CloneSample',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}/actions/clone`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Clones a sample.
 *
 * @return CloneSampleResponse
 */
async function cloneSample(instanceId: string, sampleId: string): CloneSampleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return cloneSampleWithOptions(instanceId, sampleId, headers, runtime);
}

model ColdStartRankRequest {
  features?: string(name='features', example='eg: k1:v1|k2:v2|k3:v1,v2,v3'),
  imei?: string(name='imei', example='abfsc'),
  items?: string(name='items', example='16240:video'),
  sceneId?: string(name='sceneId', example='sceneId'),
  userId?: string(name='userId', example='1'),
}

model ColdStartRankResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      itemId?: string(name='itemId', example='3_Lwm4vy1'),
      itemType?: string(name='itemType', example='article'),
      traceInfo?: string(name='traceInfo', example='1007.62364.131773.100200300000000:d709586e-643c-4fcb-a35c-6c5e8cd6756e:Grr8KG::0:sy_list_gul:::1:content___3_Lwm4vy:article:i2i_common_common:9.385107352002104E-4:0.25131988525390625:null:1677207034118::context__recall_index=253,context__hour=10,context__trigger_num=2::002bc90e-0d30-4682-9de3-1f4bad73702e:i2i_scategory_common,hot_common,i2i_common_common,i2i_swing_common:::::'),
    }
  ](name='result'),
}

model ColdStartRankResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ColdStartRankResponseBody(name='body'),
}

/**
 * @summary 该接口用于获取指定冷启动实例的排序结果。
 *
 * @param request ColdStartRankRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ColdStartRankResponse
 */
async function coldStartRankWithOptions(instanceId: string, request: ColdStartRankRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ColdStartRankResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.features)) {
    query['features'] = request.features;
  }
  if (!Util.isUnset(request.imei)) {
    query['imei'] = request.imei;
  }
  if (!Util.isUnset(request.items)) {
    query['items'] = request.items;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ColdStartRank',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/cold-start/${OpenApiUtil.getEncodeParam(instanceId)}/actions/rank`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 该接口用于获取指定冷启动实例的排序结果。
 *
 * @param request ColdStartRankRequest
 * @return ColdStartRankResponse
 */
async function coldStartRank(instanceId: string, request: ColdStartRankRequest): ColdStartRankResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return coldStartRankWithOptions(instanceId, request, headers, runtime);
}

model CreateCustomAnalysisTaskRequest {
  type?: string(name='type', description='This parameter is required.', example='ITEM_CUSTOM'),
}

model CreateCustomAnalysisTaskResponseBody = {
  code?: string(name='code', example='200'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', example='16B78383-2803-4964-9605-37B30C073B0E'),
  result?: map[string]any(name='result', example='123'),
}

model CreateCustomAnalysisTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCustomAnalysisTaskResponseBody(name='body'),
}

/**
 * @summary 创建自定义分析任务
 *
 * @param request CreateCustomAnalysisTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCustomAnalysisTaskResponse
 */
async function createCustomAnalysisTaskWithOptions(instanceId: string, request: CreateCustomAnalysisTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateCustomAnalysisTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateCustomAnalysisTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/custom-analysis-tasks`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建自定义分析任务
 *
 * @param request CreateCustomAnalysisTaskRequest
 * @return CreateCustomAnalysisTaskResponse
 */
async function createCustomAnalysisTask(instanceId: string, request: CreateCustomAnalysisTaskRequest): CreateCustomAnalysisTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createCustomAnalysisTaskWithOptions(instanceId, request, headers, runtime);
}

model CreateCustomSampleResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: Sample(name='result'),
}

model CreateCustomSampleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateCustomSampleResponseBody(name='body'),
}

/**
 * @summary 创建自定义样本
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateCustomSampleResponse
 */
async function createCustomSampleWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateCustomSampleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateCustomSample',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建自定义样本
 *
 * @return CreateCustomSampleResponse
 */
async function createCustomSample(instanceId: string): CreateCustomSampleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createCustomSampleWithOptions(instanceId, headers, runtime);
}

model CreateDataDiagnoseTaskResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: boolean(name='result', example='true'),
}

model CreateDataDiagnoseTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateDataDiagnoseTaskResponseBody(name='body'),
}

/**
 * @summary 创建数据诊断任务
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateDataDiagnoseTaskResponse
 */
async function createDataDiagnoseTaskWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateDataDiagnoseTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateDataDiagnoseTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/data-diagnose-task`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建数据诊断任务
 *
 * @return CreateDataDiagnoseTaskResponse
 */
async function createDataDiagnoseTask(instanceId: string): CreateDataDiagnoseTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createDataDiagnoseTaskWithOptions(instanceId, headers, runtime);
}

model CreateExtraDataSourceResponseBody = {
  requestId?: string(name='requestId', description='The ID of the request.', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: ExtraDataSource(name='result', description='The returned result.'),
}

model CreateExtraDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateExtraDataSourceResponseBody(name='body'),
}

/**
 * @summary Creates a data source.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateExtraDataSourceResponse
 */
async function createExtraDataSourceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateExtraDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateExtraDataSource',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/extra-data-sources`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a data source.
 *
 * @return CreateExtraDataSourceResponse
 */
async function createExtraDataSource(instanceId: string): CreateExtraDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createExtraDataSourceWithOptions(instanceId, headers, runtime);
}

model CreateFilteringAlgorithmRequest {
  dryRun?: string(name='dryRun', description='xxx', example='true'),
}

model CreateFilteringAlgorithmResponseBody = {
  requestId?: string(name='requestId', description='The type of the data source.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: {
    algorithmId?: string(name='algorithmId', description='The additional information.', example='abc'),
    gmtCreate?: string(name='gmtCreate', description='The time when the filtering table was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in Coordinated Universal Time (UTC).', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', description='The fluctuation threshold for the data entries in the source table.', example='2018-12-07T02:24:26.000Z'),
    meta?: {
      algorithmName?: string(name='algorithmName', description='The name of the filtering table.', example='algorithmTest'),
      category?: string(name='category', description='The response body.', example='1_2'),
      cron?: string(name='cron', description='The fluctuation threshold for the size of the index.', example='0 0/12 0 * *'),
      cronEnabled?: boolean(name='cronEnabled', description='The time when the filtering table was last modified. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed UTC.', example='true'),
      description?: string(name='description', description='The description of the filtering table.', example='xx'),
      extInfo?: map[string]any(name='extInfo', description='The name of the MaxCompute project.', example='{}'),
      gmtCreate?: string(name='gmtCreate', description='The information about the filtering table.', example='2018-12-07T02:24:26.000Z'),
      gmtModified?: string(name='gmtModified', description='Indicates whether the scheduled task is enabled.', example='2018-12-07T02:24:26.000Z'),
      projectName?: string(name='projectName', description='The ID of the filtering table.', example='testname'),
      status?: string(name='status', description='The CRON expression of the scheduled task. Example: 0 0/12 0 \\\\* \\\\*, which indicates that the task is scheduled at 00:00 and 12:00 every day.', example='Running'),
      tableName?: string(name='tableName', description='The metadata of the filtering table.', example='table_test'),
      threshold?: {
        indexLossThreshold?: int32(name='indexLossThreshold', description='The time when the filtering table was modified.', example='1'),
        indexSizeThreshold?: int32(name='indexSizeThreshold', description='The fluctuation threshold for the size of the source table.', example='1'),
        sourceDataRecordThreshold?: int32(name='sourceDataRecordThreshold', description='The category of the filtering table.', example='1'),
        sourceDataSizeThreshold?: int32(name='sourceDataSizeThreshold', description='The fluctuation threshold for the loss of the index data.', example='1'),
      }(name='threshold', description='0 0/12 0 * *"'),
      type?: string(name='type', description='The ID of the request.', example='ODPS'),
    }(name='meta', description='The threshold.'),
    status?: string(name='status', description='The name of the filtering algorithm.', example='Running'),
  }(name='result', description='Specifies whether to perform a dry run. Valid values: true: performs a dry run. false: performs a dry run and sends the request.'),
}

model CreateFilteringAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFilteringAlgorithmResponseBody(name='body'),
}

/**
 * @summary The time when the filtering table was created.
 *
 * @param request CreateFilteringAlgorithmRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFilteringAlgorithmResponse
 */
async function createFilteringAlgorithmWithOptions(instanceId: string, request: CreateFilteringAlgorithmRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateFilteringAlgorithmResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFilteringAlgorithm',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The time when the filtering table was created.
 *
 * @param request CreateFilteringAlgorithmRequest
 * @return CreateFilteringAlgorithmResponse
 */
async function createFilteringAlgorithm(instanceId: string, request: CreateFilteringAlgorithmRequest): CreateFilteringAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createFilteringAlgorithmWithOptions(instanceId, request, headers, runtime);
}

model CreateFlowControlTaskRequest {
  dryRun?: boolean(name='dryRun', description='Specifies whether to perform only a dry run, without performing the actual request.', example='true'),
}

model CreateFlowControlTaskResponseBody = {
  code?: string(name='code', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='EDF43C1F-99E4-431F-A7C0-8B260A5A792E'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The time when the task was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2020-04-27T06:38:28.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the task was last modified. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in Coordinated Universal Time (UTC).', example='2018-12-06T11:17:49.000Z'),
    status?: string(name='status', description='The task state.', example='DRAFT'),
    taskId?: string(name='taskId', description='The task ID.', example='1667297014460'),
  }(name='result', description='The returned result.'),
}

model CreateFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary Creates a throttling task.
 *
 * @param request CreateFlowControlTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateFlowControlTaskResponse
 */
async function createFlowControlTaskWithOptions(instanceId: string, request: CreateFlowControlTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateFlowControlTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a throttling task.
 *
 * @param request CreateFlowControlTaskRequest
 * @return CreateFlowControlTaskResponse
 */
async function createFlowControlTask(instanceId: string, request: CreateFlowControlTaskRequest): CreateFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createFlowControlTaskWithOptions(instanceId, request, headers, runtime);
}

model CreateInstanceResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    instanceId?: string(name='instanceId', description='The instance ID.', example='airec-cn-xxxxx'),
  }(name='result', description='The returned results.'),
}

model CreateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateInstanceResponseBody(name='body'),
}

/**
 * @summary Creates an Artificial Intelligence Recommendation (AIRec) instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateInstanceResponse
 */
async function createInstanceWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): CreateInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates an Artificial Intelligence Recommendation (AIRec) instance.
 *
 * @return CreateInstanceResponse
 */
async function createInstance(): CreateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createInstanceWithOptions(headers, runtime);
}

model CreateRankingModelRequest {
  dryRun?: boolean(name='dryRun', example='true'),
}

model CreateRankingModelResponseBody = {
  code?: string(name='code', example='200'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: {
    gmtCreate?: string(name='gmtCreate', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', example='2018-12-07T02:24:26.000Z'),
    meta?: map[string]any(name='meta', example='map'),
    rankingModelId?: string(name='rankingModelId', example='ranktest'),
  }(name='result'),
}

model CreateRankingModelResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateRankingModelResponseBody(name='body'),
}

/**
 * @param request CreateRankingModelRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateRankingModelResponse
 */
async function createRankingModelWithOptions(instanceId: string, request: CreateRankingModelRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateRankingModelResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateRankingModel',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-models`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request CreateRankingModelRequest
 * @return CreateRankingModelResponse
 */
async function createRankingModel(instanceId: string, request: CreateRankingModelRequest): CreateRankingModelResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createRankingModelWithOptions(instanceId, request, headers, runtime);
}

model CreateRankingModelTemplateResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: RankingModelTemplate(name='result'),
}

model CreateRankingModelTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateRankingModelTemplateResponseBody(name='body'),
}

/**
 * @summary 创建排序模型模板配置
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateRankingModelTemplateResponse
 */
async function createRankingModelTemplateWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateRankingModelTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateRankingModelTemplate',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-templates`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建排序模型模板配置
 *
 * @return CreateRankingModelTemplateResponse
 */
async function createRankingModelTemplate(instanceId: string): CreateRankingModelTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createRankingModelTemplateWithOptions(instanceId, headers, runtime);
}

model CreateRankingSystemResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: RankingSystem(name='result'),
}

model CreateRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateRankingSystemResponseBody(name='body'),
}

/**
 * @summary 创建排序服务
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateRankingSystemResponse
 */
async function createRankingSystemWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateRankingSystemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建排序服务
 *
 * @return CreateRankingSystemResponse
 */
async function createRankingSystem(instanceId: string): CreateRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createRankingSystemWithOptions(instanceId, headers, runtime);
}

model CreateRuleResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The time when the rule was created.', example='2020-04-27T06:38:28.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the rule was last modified.', example='2020-04-27T06:38:28.000Z'),
    ruleId?: string(name='ruleId', description='The rule ID.', example='98493A14-D619-4E88-9F8D-108939817F9F'),
    status?: string(name='status', description='Indicates whether the rule is enabled. Valid values: true and false.', example='true'),
  }(name='result', description='The returned results.'),
}

model CreateRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateRuleResponseBody(name='body'),
}

/**
 * @summary Creates a rule.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateRuleResponse
 */
async function createRuleWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): CreateRuleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'CreateRule',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rules`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Creates a rule.
 *
 * @return CreateRuleResponse
 */
async function createRule(instanceId: string): CreateRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createRuleWithOptions(instanceId, headers, runtime);
}

model CreateSampleFormatConfigRequest {
  body?: map[string]any(name='body'),
}

model CreateSampleFormatConfigResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: map[string]any(name='result', example='result'),
}

model CreateSampleFormatConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSampleFormatConfigResponseBody(name='body'),
}

/**
 * @summary 创建样本格式化配置
 *
 * @param request CreateSampleFormatConfigRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSampleFormatConfigResponse
 */
async function createSampleFormatConfigWithOptions(instanceId: string, sampleId: string, request: CreateSampleFormatConfigRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateSampleFormatConfigResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'CreateSampleFormatConfig',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}/format-configs`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建样本格式化配置
 *
 * @param request CreateSampleFormatConfigRequest
 * @return CreateSampleFormatConfigResponse
 */
async function createSampleFormatConfig(instanceId: string, sampleId: string, request: CreateSampleFormatConfigRequest): CreateSampleFormatConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createSampleFormatConfigWithOptions(instanceId, sampleId, request, headers, runtime);
}

model CreateSceneRequest {
  dryRun?: boolean(name='dryRun'),
}

model CreateSceneResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: {
    gmtCreate?: string(name='gmtCreate'),
    gmtModified?: string(name='gmtModified'),
    sceneId?: string(name='sceneId'),
    status?: string(name='status'),
  }(name='result'),
}

model CreateSceneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateSceneResponseBody(name='body'),
}

/**
 * @summary Verifies the information that you specified for creating a scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param request CreateSceneRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateSceneResponse
 */
async function createSceneWithOptions(instanceId: string, request: CreateSceneRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateSceneResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dryRun)) {
    query['dryRun'] = request.dryRun;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateScene',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Verifies the information that you specified for creating a scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param request CreateSceneRequest
 * @return CreateSceneResponse
 */
async function createScene(instanceId: string, request: CreateSceneRequest): CreateSceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createSceneWithOptions(instanceId, request, headers, runtime);
}

model CreateUmengTokenRequest {
  code?: string(name='code', description='This parameter is required.'),
}

model CreateUmengTokenResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: boolean(name='result'),
}

model CreateUmengTokenResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: CreateUmengTokenResponseBody(name='body'),
}

/**
 * @summary 创建友盟授权token
 *
 * @param request CreateUmengTokenRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return CreateUmengTokenResponse
 */
async function createUmengTokenWithOptions(request: CreateUmengTokenRequest, headers: map[string]string, runtime: Util.RuntimeOptions): CreateUmengTokenResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.code)) {
    query['code'] = request.code;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'CreateUmengToken',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/umeng/token`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 创建友盟授权token
 *
 * @param request CreateUmengTokenRequest
 * @return CreateUmengTokenResponse
 */
async function createUmengToken(request: CreateUmengTokenRequest): CreateUmengTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return createUmengTokenWithOptions(request, headers, runtime);
}

model DecribeRankingModelResponseBody = {
  code?: string(name='code', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='xxx'),
  requestId?: string(name='requestId', description='The request ID.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The time when the ranking model was created.', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the ranking model was last modified.', example='2020-04-27T06:38:28.000Z'),
    meta?: map[string]any(name='meta', description='The metadata.'),
    rankingModelId?: string(name='rankingModelId', description='The ID of the ranking model.', example='ranktest'),
  }(name='result', description='The returned results.'),
}

model DecribeRankingModelResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DecribeRankingModelResponseBody(name='body'),
}

/**
 * @summary Queries the information of a ranking model.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DecribeRankingModelResponse
 */
async function decribeRankingModelWithOptions(instanceId: string, rankingModelId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DecribeRankingModelResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DecribeRankingModel',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-models/${OpenApiUtil.getEncodeParam(rankingModelId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information of a ranking model.
 *
 * @return DecribeRankingModelResponse
 */
async function decribeRankingModel(instanceId: string, rankingModelId: string): DecribeRankingModelResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return decribeRankingModelWithOptions(instanceId, rankingModelId, headers, runtime);
}

model DeleteDataSetResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: long(name='gmtCreate', description='The time when the data source was created.', example='1544112000000'),
    gmtModified?: long(name='gmtModified', description='The time when the data source was last modified.', example='1544112000000'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='airec-cn-o400whm78004'),
    state?: string(name='state', description='The state for the dataset of the current version. Example: Importing. The value indicates that the dataset of the current version is being imported.', example='Importing'),
    versionId?: string(name='versionId', description='The version number of the dataset.', example='20181023214546'),
  }(name='result', description='The details about the dataset.'),
}

model DeleteDataSetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteDataSetResponseBody(name='body'),
}

/**
 * @summary Deletes a dataset of a specified version for an instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteDataSetResponse
 */
async function deleteDataSetWithOptions(instanceId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteDataSetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteDataSet',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSets/${OpenApiUtil.getEncodeParam(versionId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a dataset of a specified version for an instance.
 *
 * @return DeleteDataSetResponse
 */
async function deleteDataSet(instanceId: string, versionId: string): DeleteDataSetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteDataSetWithOptions(instanceId, versionId, headers, runtime);
}

model DeleteExperimentResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: boolean(name='result', example='true'),
}

model DeleteExperimentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteExperimentResponseBody(name='body'),
}

/**
 * @summary The ID of the test.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteExperimentResponse
 */
async function deleteExperimentWithOptions(instanceId: string, sceneId: string, experimentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteExperimentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteExperiment',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments/${OpenApiUtil.getEncodeParam(experimentId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the test.
 *
 * @return DeleteExperimentResponse
 */
async function deleteExperiment(instanceId: string, sceneId: string, experimentId: string): DeleteExperimentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteExperimentWithOptions(instanceId, sceneId, experimentId, headers, runtime);
}

model DeleteExtraDataSourceResponseBody = {
  requestId?: string(name='requestId', description='请求ID。', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: ExtraDataSource(name='result', description='返回参数。'),
}

model DeleteExtraDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteExtraDataSourceResponseBody(name='body'),
}

/**
 * @summary 删除特征、样本等表扩展数据源
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteExtraDataSourceResponse
 */
async function deleteExtraDataSourceWithOptions(instanceId: string, type: string, dataSourceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteExtraDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteExtraDataSource',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/extra-data-sources/${OpenApiUtil.getEncodeParam(type)}/${OpenApiUtil.getEncodeParam(dataSourceId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除特征、样本等表扩展数据源
 *
 * @return DeleteExtraDataSourceResponse
 */
async function deleteExtraDataSource(instanceId: string, type: string, dataSourceId: string): DeleteExtraDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteExtraDataSourceWithOptions(instanceId, type, dataSourceId, headers, runtime);
}

model DeleteFilteringAlgorithmResponseBody = {
  requestId?: string(name='requestId', description='The ID of the request.', example='936BE457-5D14-4DBD-85AE-176F7BA8D96D'),
  result?: {
    algorithmId?: string(name='algorithmId', description='The ID of the specified filtering table.', example='123'),
    gmtCreate?: string(name='gmtCreate', description='The time when the filtering table was created.', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the filtering table was modified.', example='2018-12-07T02:24:26.000Z'),
    meta?: {
      algorithmName?: string(name='algorithmName', description='The name of the filtering algorithm.', example='user'),
      category?: string(name='category', description='The category of the filtering algorithm.', example='i2i'),
      clusterId?: string(name='clusterId', description='The ID of the cluster.', example='1001'),
      cron?: string(name='cron', description='The CRON expression of the scheduled task. Example: 0 0/12 0 \\\\* \\\\*. The value indicates that the task is scheduled at 00:00 and 12:00 every day.', example='0 0/12 0 * *'),
      cronEnabled?: boolean(name='cronEnabled', description='N/A', example='true'),
      description?: string(name='description', description='The description of the filtering table.', example='Training task'),
      extInfo?: {
        itemSeparator?: string(name='itemSeparator', description='The delimiter that is used to separate items.', example=';'),
        kvSeparator?: string(name='kvSeparator', description='The delimiter that is used to separate keys and values.', example=';'),
      }(name='extInfo', description='The additional information.'),
      metaType?: string(name='metaType', description='The type of the metadata.', example='odps'),
      projectName?: string(name='projectName', description='The name of the project.', example='name01'),
      tableName?: string(name='tableName', description='The name of the table.', example='table01'),
      taskId?: string(name='taskId', description='The ID of the task.', example='test01'),
      threshold?: {
        indexLossThreshold?: int32(name='indexLossThreshold', description='The fluctuation threshold for the loss of the index data.', example='1'),
        indexSizeThreshold?: int32(name='indexSizeThreshold', description='The fluctuation threshold for the size of the index.', example='1'),
        sourceDataRecordThreshold?: int32(name='sourceDataRecordThreshold', description='The fluctuation threshold for the data entries in the source table.', example='1'),
        sourceDataSizeThreshold?: int32(name='sourceDataSizeThreshold', description='The fluctuation threshold for the size of the source table.', example='1'),
      }(name='threshold', description='The threshold.'),
      type?: string(name='type', description='The type of the data source. Only MaxCompute is supported.', example='ODPS'),
    }(name='meta', description='The metadata of the filtering table.'),
    status?: string(name='status', description='The state of the filtering table. Valid values: Draft, Running, Offline, and Deleted.', example='Running'),
  }(name='result', description='The returned result.'),
}

model DeleteFilteringAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFilteringAlgorithmResponseBody(name='body'),
}

/**
 * @summary Deletes the configurations of a specified filtering table and the information about the related index table.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFilteringAlgorithmResponse
 */
async function deleteFilteringAlgorithmWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteFilteringAlgorithmResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteFilteringAlgorithm',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes the configurations of a specified filtering table and the information about the related index table.
 *
 * @return DeleteFilteringAlgorithmResponse
 */
async function deleteFilteringAlgorithm(instanceId: string, algorithmId: string): DeleteFilteringAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteFilteringAlgorithmWithOptions(instanceId, algorithmId, headers, runtime);
}

model DeleteFlowControlTaskResponseBody = {
  requestId?: string(name='requestId', description='The ID of the request.', example='6E427B10-30FC-1873-922F-FC176D3398D4'),
  result?: boolean(name='result', description='Indicates whether the task was deleted. Valid values: true and false.', example='true'),
}

model DeleteFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary Deletes a throttling task.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteFlowControlTaskResponse
 */
async function deleteFlowControlTaskWithOptions(instanceId: string, taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteFlowControlTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a throttling task.
 *
 * @return DeleteFlowControlTaskResponse
 */
async function deleteFlowControlTask(instanceId: string, taskId: string): DeleteFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteFlowControlTaskWithOptions(instanceId, taskId, headers, runtime);
}

model DeleteRankingModelResponseBody = {
  code?: string(name='code', example='200'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='D486768B-8BF8-4D80-B491-43DC3D0AF8AB'),
  result?: {
    meta?: map[string]any(name='meta', description='meta'),
    rankingModelId?: string(name='rankingModelId'),
  }(name='result'),
}

model DeleteRankingModelResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteRankingModelResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteRankingModelResponse
 */
async function deleteRankingModelWithOptions(instanceId: string, rankingModelId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteRankingModelResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteRankingModel',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-models/${OpenApiUtil.getEncodeParam(rankingModelId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DeleteRankingModelResponse
 */
async function deleteRankingModel(instanceId: string, rankingModelId: string): DeleteRankingModelResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteRankingModelWithOptions(instanceId, rankingModelId, headers, runtime);
}

model DeleteRankingModelTemplateResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: RankingModelTemplate(name='result'),
}

model DeleteRankingModelTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteRankingModelTemplateResponseBody(name='body'),
}

/**
 * @summary 删除排序模型模板
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteRankingModelTemplateResponse
 */
async function deleteRankingModelTemplateWithOptions(instanceId: string, templateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteRankingModelTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteRankingModelTemplate',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-templates/${OpenApiUtil.getEncodeParam(templateId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除排序模型模板
 *
 * @return DeleteRankingModelTemplateResponse
 */
async function deleteRankingModelTemplate(instanceId: string, templateId: string): DeleteRankingModelTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteRankingModelTemplateWithOptions(instanceId, templateId, headers, runtime);
}

model DeleteRankingModelVersionResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
}

model DeleteRankingModelVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteRankingModelVersionResponseBody(name='body'),
}

/**
 * @summary 删除排序模型版本
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteRankingModelVersionResponse
 */
async function deleteRankingModelVersionWithOptions(instanceId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteRankingModelVersionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteRankingModelVersion',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-versions/${OpenApiUtil.getEncodeParam(versionId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除排序模型版本
 *
 * @return DeleteRankingModelVersionResponse
 */
async function deleteRankingModelVersion(instanceId: string, versionId: string): DeleteRankingModelVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteRankingModelVersionWithOptions(instanceId, versionId, headers, runtime);
}

model DeleteRankingSystemResponseBody = {
  requestId?: string(name='requestId'),
  result?: RankingSystem(name='result'),
}

model DeleteRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteRankingSystemResponseBody(name='body'),
}

/**
 * @summary 删除某个排序服务
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteRankingSystemResponse
 */
async function deleteRankingSystemWithOptions(instanceId: string, name: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteRankingSystemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除某个排序服务
 *
 * @return DeleteRankingSystemResponse
 */
async function deleteRankingSystem(instanceId: string, name: string): DeleteRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteRankingSystemWithOptions(instanceId, name, headers, runtime);
}

model DeleteSampleResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: Sample(name='result'),
}

model DeleteSampleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSampleResponseBody(name='body'),
}

/**
 * @summary 删除样本
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSampleResponse
 */
async function deleteSampleWithOptions(instanceId: string, sampleId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteSampleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteSample',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 删除样本
 *
 * @return DeleteSampleResponse
 */
async function deleteSample(instanceId: string, sampleId: string): DeleteSampleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteSampleWithOptions(instanceId, sampleId, headers, runtime);
}

model DeleteSceneResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: {
    sceneId?: string(name='sceneId'),
  }(name='result'),
}

model DeleteSceneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeleteSceneResponseBody(name='body'),
}

/**
 * @summary Deletes a scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeleteSceneResponse
 */
async function deleteSceneWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DeleteSceneResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DeleteScene',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}`,
    method = 'DELETE',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Deletes a scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @return DeleteSceneResponse
 */
async function deleteScene(instanceId: string, sceneId: string): DeleteSceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deleteSceneWithOptions(instanceId, sceneId, headers, runtime);
}

model DeployRankingSystemRequest {
  body?: map[string]any(name='body', description='The schema of the response parameters.', example='"meta": {
    "autoDeploy": true,
    "autoDeployAuc": "0.9",
    "conf":"",
    "predictEngineType": "EAS",
    "predictEngine":{
    	"resourceId": "eas-oljkkdrggxhx7eizjd"
    }
  }'),
}

model DeployRankingSystemResponseBody = {
  requestId?: string(name='requestId', description='The returned result.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: map[string]any(name='result', description='__null__', example='xxx'),
}

model DeployRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DeployRankingSystemResponseBody(name='body'),
}

/**
 * @summary The ID of the instance.
 *
 * @param request DeployRankingSystemRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DeployRankingSystemResponse
 */
async function deployRankingSystemWithOptions(instanceId: string, name: string, request: DeployRankingSystemRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DeployRankingSystemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeployRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}/actions/deploy`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the instance.
 *
 * @param request DeployRankingSystemRequest
 * @return DeployRankingSystemResponse
 */
async function deployRankingSystem(instanceId: string, name: string, request: DeployRankingSystemRequest): DeployRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return deployRankingSystemWithOptions(instanceId, name, request, headers, runtime);
}

model DescribeBaseExperimentResponseBody = {
  requestId?: string(name='requestId', example='A74E3FB7-406C-5CBB-833E-E49308B5DC05'),
  result?: {
    algorithms?: [ 
      {
        category?: string(name='category', example='RECALL'),
        config?: [ 
          {
            defaultValue?: string(name='defaultValue', example='true'),
            experimentValue?: string(name='experimentValue', example='400'),
            key?: string(name='key', example='I2I'),
            name?: string(name='name', example='xxx'),
          }
        ](name='config'),
        defaultValue?: string(name='defaultValue', example='true'),
        experimentValue?: string(name='experimentValue', example='400'),
        hasConfig?: boolean(name='hasConfig', example='false'),
        key?: string(name='key', example='I2I'),
        name?: string(name='name', example='xxx'),
        type?: string(name='type', example='SYSTEM'),
      }
    ](name='algorithms'),
    base?: boolean(name='base', example='true'),
    buckets?: [ string ](name='buckets'),
    description?: string(name='description', example='xxx'),
    experimentId?: string(name='experimentId', example='xxx'),
    name?: string(name='name'),
    offlineTime?: string(name='offlineTime', example='2020-12-07T06:47:30.000Z'),
    onlineTime?: string(name='onlineTime', example='2020-12-07T06:47:30.000Z'),
    status?: string(name='status', example='Init'),
  }(name='result'),
}

model DescribeBaseExperimentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeBaseExperimentResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeBaseExperimentResponse
 */
async function describeBaseExperimentWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeBaseExperimentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeBaseExperiment',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/base-experiment`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeBaseExperimentResponse
 */
async function describeBaseExperiment(instanceId: string, sceneId: string): DescribeBaseExperimentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeBaseExperimentWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeCustomAnalysisTaskRequest {
  type?: string(name='type', description='This parameter is required.', example='ITEM_CUSTOM'),
}

model DescribeCustomAnalysisTaskResponseBody = {
  code?: string(name='code', example='xxx'),
  message?: string(name='message', example='xxx'),
  requestId?: string(name='requestId', example='16B78383-2803-4964-9605-37B30C073B0E'),
  result?: map[string]any(name='result', example='xxx'),
}

model DescribeCustomAnalysisTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeCustomAnalysisTaskResponseBody(name='body'),
}

/**
 * @summary 查询自定义分析任务
 *
 * @param request DescribeCustomAnalysisTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeCustomAnalysisTaskResponse
 */
async function describeCustomAnalysisTaskWithOptions(instanceId: string, taskId: string, request: DescribeCustomAnalysisTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeCustomAnalysisTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCustomAnalysisTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/custom-analysis-tasks/${OpenApiUtil.getEncodeParam(taskId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询自定义分析任务
 *
 * @param request DescribeCustomAnalysisTaskRequest
 * @return DescribeCustomAnalysisTaskResponse
 */
async function describeCustomAnalysisTask(instanceId: string, taskId: string, request: DescribeCustomAnalysisTaskRequest): DescribeCustomAnalysisTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeCustomAnalysisTaskWithOptions(instanceId, taskId, request, headers, runtime);
}

model DescribeDataSetMessageResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      errorLevel?: string(name='errorLevel', example='warn'),
      errorType?: string(name='errorType'),
      message?: string(name='message'),
      timestamp?: string(name='timestamp', example='20181211 17:27:44'),
    }
  ](name='result'),
}

model DescribeDataSetMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDataSetMessageResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDataSetMessageResponse
 */
async function describeDataSetMessageWithOptions(instanceId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeDataSetMessageResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeDataSetMessage',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSets/${OpenApiUtil.getEncodeParam(versionId)}/messages`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeDataSetMessageResponse
 */
async function describeDataSetMessage(instanceId: string, versionId: string): DescribeDataSetMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeDataSetMessageWithOptions(instanceId, versionId, headers, runtime);
}

model DescribeDefaultAlgorithmsResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='F60021C4-57AF-5F46-9B3E-FCEF1C7A1459'),
  result?: [ 
    {
      category?: string(name='category', description='The algorithm category. Valid values: RECALL and RANK.', example='RECALL'),
      config?: [ 
        {
          defaultValue?: string(name='defaultValue', description='The default value of the algorithm configuration item.', example='swing;commoni2i;pcategory;scategory'),
          experimentValue?: string(name='experimentValue', description='The custom value of the algorithm configuration item.', example='300'),
          key?: string(name='key', description='The key of the algorithm configuration item.', example='I2I-truncedquantity'),
          name?: string(name='name', description='The name of the algorithm configuration item. (Note: If you use the default algorithm, the console obtains the algorithm name from Medusa. If you customize an algorithm for the experiment, the algorithm name is directly returned.)'),
        }
      ](name='config', description='The information about the child configuration item.'),
      defaultValue?: string(name='defaultValue', description='The default value of the algorithm. If you set key to i2i, hot, or new, the value of this parameter is true or false. If you set key to mtorder, the value of this parameter is a list of filtering algorithms ranked by priority.', example='true'),
      experimentValue?: string(name='experimentValue', description='The custom value of the algorithm.', example='300'),
      hasConfig?: boolean(name='hasConfig', description='Indicates whether child configuration items exist. Valid values: true and false.', example='true'),
      key?: string(name='key', description='The algorithm key. Valid values: i2i: the I2I filtering algorithm. u2x2i: the U2X2I filtering algorithm. hot: the filtering algorithm for popular items. new: the filtering algorithm for new items. embedding: the vector filtering algorithm. mtorder: the priority of the filtering algorithm. rankservice: the ranking service.', example='I2I'),
      name?: string(name='name', description='The algorithm name. (Note: If you use the default algorithm, the console obtains the algorithm name from Medusa. If you customize an algorithm for the experiment, the algorithm name is directly returned.)', example='xxx'),
      type?: string(name='type', description='The algorithm type. Valid values: SYSTEM and CUSTOM.', example='SYSTEM'),
    }
  ](name='result', description='The returned result.'),
}

model DescribeDefaultAlgorithmsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeDefaultAlgorithmsResponseBody(name='body'),
}

/**
 * @summary Queries the information of default algorithms.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeDefaultAlgorithmsResponse
 */
async function describeDefaultAlgorithmsWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeDefaultAlgorithmsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeDefaultAlgorithms',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/default-algorithms`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information of default algorithms.
 *
 * @return DescribeDefaultAlgorithmsResponse
 */
async function describeDefaultAlgorithms(instanceId: string, sceneId: string): DescribeDefaultAlgorithmsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeDefaultAlgorithmsWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeExperimentResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: {
    algorithms?: [ 
      {
        category?: string(name='category', description='The category of the item.', example='2'),
        config?: [ 
          {
            defaultValue?: string(name='defaultValue', example='true'),
            experimentValue?: string(name='experimentValue', example='400'),
            key?: string(name='key', description='key', example='I2I'),
            name?: string(name='name', example='xxx'),
          }
        ](name='config'),
        defaultValue?: string(name='defaultValue', description='None', example='true'),
        experimentValue?: string(name='experimentValue', description='None'),
        hasConfig?: boolean(name='hasConfig', description='None', example='false'),
        key?: string(name='key', description='The key.', example='I2I'),
        name?: string(name='name', description='The name of the experiment.', example='test'),
        type?: string(name='type', description='None', example='SYSTEM'),
      }
    ](name='algorithms', description='The parameters about the experiment.'),
    base?: boolean(name='base', description='None', example='true'),
    buckets?: [ string ](name='buckets'),
    description?: string(name='description', description='The description of the experiment.', example='xxx'),
    experimentId?: string(name='experimentId', description='The experiment ID.', example='12345'),
    name?: string(name='name', description='The name of the experiment.', example='test'),
    offlineTime?: string(name='offlineTime', description='The time when the experiment was unpublished.', example='2020-11-11T09:47:43.000Z'),
    onlineTime?: string(name='onlineTime', description='The time when the experiment was published.', example='2020-11-11T09:47:43.000Z'),
    status?: string(name='status', description='The state of the experiment.', example='1'),
  }(name='result', description='The returned results.'),
}

model DescribeExperimentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeExperimentResponseBody(name='body'),
}

/**
 * @summary Queries the details about an experiment.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeExperimentResponse
 */
async function describeExperimentWithOptions(instanceId: string, sceneId: string, experimentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeExperimentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeExperiment',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments/${OpenApiUtil.getEncodeParam(experimentId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details about an experiment.
 *
 * @return DescribeExperimentResponse
 */
async function describeExperiment(instanceId: string, sceneId: string, experimentId: string): DescribeExperimentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeExperimentWithOptions(instanceId, sceneId, experimentId, headers, runtime);
}

model DescribeExperimentEnvResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: {
    bucketCount?: int32(name='bucketCount', example='10'),
    divideType?: string(name='divideType', example='UID'),
  }(name='result'),
}

model DescribeExperimentEnvResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeExperimentEnvResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeExperimentEnvResponse
 */
async function describeExperimentEnvWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeExperimentEnvResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeExperimentEnv',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiment-env`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeExperimentEnvResponse
 */
async function describeExperimentEnv(instanceId: string, sceneId: string): DescribeExperimentEnvResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeExperimentEnvWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeExperimentEnvProgressResponseBody = {
  requestId?: string(name='requestId', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: {
    progress?: int32(name='progress'),
    status?: string(name='status'),
  }(name='result'),
}

model DescribeExperimentEnvProgressResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeExperimentEnvProgressResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeExperimentEnvProgressResponse
 */
async function describeExperimentEnvProgressWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeExperimentEnvProgressResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeExperimentEnvProgress',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiment-progress`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeExperimentEnvProgressResponse
 */
async function describeExperimentEnvProgress(instanceId: string, sceneId: string): DescribeExperimentEnvProgressResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeExperimentEnvProgressWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeFilteringAlgorithmResponseBody = {
  requestId?: string(name='requestId', description='The metadata of the filtering table.', example='7585C2B2-0D61-4C96-AC5D-B960BFEDD4A3'),
  result?: {
    algorithmId?: string(name='algorithmId', description='The fluctuation threshold for the size of the source table.', example='abc'),
    gmtCreate?: string(name='gmtCreate', description='The category of the filtering table.', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', description='The name of the project.', example='2018-12-07T02:24:26.000Z'),
    meta?: {
      algorithmName?: string(name='algorithmName', description='The time when the filtering table was created.', example='test'),
      category?: string(name='category', description='Indicates whether the scheduled task is enabled.', example='1_2'),
      clusterId?: string(name='clusterId', description='N/A', example='244'),
      cron?: string(name='cron', description='The information about the filtering table.', example='* * 24 7 0'),
      cronEnabled?: boolean(name='cronEnabled', description='The ID of the filtering table.', example='Y'),
      description?: string(name='description', description='The time when the filtering table was modified.', example='test'),
      extInfo?: {
        itemSeparator?: string(name='itemSeparator', description='The description of the filtering table.', example=','),
        kvSeparator?: string(name='kvSeparator', description='The fluctuation threshold for the size of the index.', example=':'),
      }(name='extInfo', description='The ID of the task.'),
      metaType?: string(name='metaType', description='The information about the filtering table.', example='metaType'),
      projectName?: string(name='projectName', description='The status of the filtering table.', example='test'),
      tableName?: string(name='tableName', description='The ID of the specified filtering table.', example='test_table'),
      taskId?: string(name='taskId', description='The CRON expression of the scheduled task.', example='taskId'),
      threshold?: {
        indexLossThreshold?: int32(name='indexLossThreshold', description='The ID of the specified instance.', example='1'),
        indexSizeThreshold?: int32(name='indexSizeThreshold', description='Queries specific configuration information about a filtering table based on the ID of the filtering table.', example='1'),
        sourceDataRecordThreshold?: int32(name='sourceDataRecordThreshold', description='The type of the data source.', example='1'),
        sourceDataSizeThreshold?: int32(name='sourceDataSizeThreshold', description='The name of the filtering table.', example='1'),
      }(name='threshold', description='The ID of the filtering table.'),
      type?: string(name='type', description='The metadata of the filtering table.', example='ODPS'),
    }(name='meta', description='The time when the filtering table was modified.'),
    status?: string(name='status', description='N/A', example='The threshold for the loss of the index data.'),
  }(name='result', description='The ID of the request.'),
}

model DescribeFilteringAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeFilteringAlgorithmResponseBody(name='body'),
}

/**
 * @summary The fluctuation threshold for the data entries in the source table.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeFilteringAlgorithmResponse
 */
async function describeFilteringAlgorithmWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeFilteringAlgorithmResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeFilteringAlgorithm',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The fluctuation threshold for the data entries in the source table.
 *
 * @return DescribeFilteringAlgorithmResponse
 */
async function describeFilteringAlgorithm(instanceId: string, algorithmId: string): DescribeFilteringAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeFilteringAlgorithmWithOptions(instanceId, algorithmId, headers, runtime);
}

model DescribeInstanceResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    chargeType?: string(name='chargeType', description='The billing method. Valid values: PrePaid and PostPaid. Only the PrePaid billing method is supported.', example='PrePaid'),
    commodityCode?: string(name='commodityCode', description='The commodity code of the recommended item.', example='airecpre'),
    dataSetVersion?: string(name='dataSetVersion', description='The version of the dataset that provides online services.', example='20181206170353'),
    expiredTime?: string(name='expiredTime', description='The time when the instance expires. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2019-01-06T16:00:00.000Z'),
    gmtCreate?: string(name='gmtCreate', description='The time when the instance was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2018-12-06T06:14:01.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the instance was last modified. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2018-12-06T11:17:49.000Z'),
    industry?: string(name='industry', description='The type of the industry. Valid values: content, item, news, video, and sns.', example='news'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='airec-cn-o400whm78004'),
    lockMode?: string(name='lockMode', description='The lock mode of the instance. Valid values: Unlock, ManualLock, and LockByExpiration.', example='Unlock'),
    name?: string(name='name', description='The name of the instance.', example='Test instance'),
    regionId?: string(name='regionId', description='The ID of the region where the instance resides.', example='cn-beijing'),
    scene?: string(name='scene', description='The name of the scene. Valid values: gul, rr, hot, and focus.', example='gul'),
    status?: string(name='status', description='The state of the instance. Valid values: Initializing, Ready, and Running.', example='Running'),
    type?: string(name='type', description='The type of the instance. Only the Standard edition is supported.', example='Standard'),
  }(name='result', description='The returned results.'),
}

model DescribeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeInstanceResponseBody(name='body'),
}

/**
 * @summary Queries the details about an instance based on the instance ID.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeInstanceResponse
 */
async function describeInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details about an instance based on the instance ID.
 *
 * @return DescribeInstanceResponse
 */
async function describeInstance(instanceId: string): DescribeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeInstanceWithOptions(instanceId, headers, runtime);
}

model DescribeLatestTaskResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: [ 
    {
      builtTime?: string(name='builtTime', example='2020-11-08T02:00:00Z'),
      code?: string(name='code', example='400'),
      costSeconds?: int32(name='costSeconds', example='50'),
      flowType?: string(name='flowType', example='Manual'),
      message?: string(name='message', example='xxx'),
      progress?: int32(name='progress', example='80'),
      rollbackEnabled?: boolean(name='rollbackEnabled', example='true'),
      size?: long(name='size', example='2938475566'),
      status?: string(name='status', example='pending'),
      switchedTime?: string(name='switchedTime', example='2020-11-08T02:00:00Z'),
      versionId?: string(name='versionId', example='20102010211'),
    }
  ](name='result'),
}

model DescribeLatestTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeLatestTaskResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeLatestTaskResponse
 */
async function describeLatestTaskWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeLatestTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeLatestTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/tasks/latest`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeLatestTaskResponse
 */
async function describeLatestTask(instanceId: string, algorithmId: string): DescribeLatestTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeLatestTaskWithOptions(instanceId, algorithmId, headers, runtime);
}

model DescribeQuotaResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    currentQps?: int32(name='currentQps', description='The current QPS.', example='8'),
    itemCount?: long(name='itemCount', description='The number of documents in the item table. Valid values:

1000000 to 10000000.', example='1000000'),
    itemCountUsed?: long(name='itemCountUsed', description='The number of items that are used in the item table.', example='100'),
    qps?: int32(name='qps', description='The queries per second (QPS). Valid values:

10 to 500.', example='10'),
    userCount?: long(name='userCount', description='The number of documents in the user table. Valid values:

1000000 to 10000000.', example='1000000'),
    userCountUsed?: long(name='userCountUsed', description='The number of users that are used in the user table.', example='100'),
  }(name='result', description='The quotas of the instance.'),
}

model DescribeQuotaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeQuotaResponseBody(name='body'),
}

/**
 * @summary Queries the quotas of an instance based on a specified instance ID.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeQuotaResponse
 */
async function describeQuotaWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeQuotaResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeQuota',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/quota`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the quotas of an instance based on a specified instance ID.
 *
 * @return DescribeQuotaResponse
 */
async function describeQuota(instanceId: string): DescribeQuotaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeQuotaWithOptions(instanceId, headers, runtime);
}

model DescribeRegionsRequest {
  acceptLanguage?: string(name='acceptLanguage', description='The language of the response. Default value: zh-cn.', example='zh-cn'),
}

model DescribeRegionsResponseBody = {
  code?: string(name='code', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='successful'),
  requestId?: string(name='requestId', description='The request ID.', example='16B78383-2803-4964-9605-37B30C073B0E'),
  result?: [ 
    {
      consoleUrl?: string(name='consoleUrl', description='The console URL.', example='xxx'),
      endpoint?: string(name='endpoint', description='The endpoint.', example='47.109.94.218'),
      localName?: string(name='localName', description='The region name.', example='xxx'),
      regionId?: string(name='regionId', description='The region ID of the instance.', example='cn-beijing'),
      status?: string(name='status', description='The instance state. Valid values: NotOpen, Processing, and Running.', example='Running'),
    }
  ](name='result', description='The returned result.'),
}

model DescribeRegionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRegionsResponseBody(name='body'),
}

/**
 * @summary Queries available Alibaba Cloud regions.
 *
 * @param request DescribeRegionsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRegionsResponse
 */
async function describeRegionsWithOptions(request: DescribeRegionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeRegionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.acceptLanguage)) {
    query['acceptLanguage'] = request.acceptLanguage;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRegions',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/configurations/regions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries available Alibaba Cloud regions.
 *
 * @param request DescribeRegionsRequest
 * @return DescribeRegionsResponse
 */
async function describeRegions(request: DescribeRegionsRequest): DescribeRegionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeRegionsWithOptions(request, headers, runtime);
}

model DescribeRuleRequest {
  ruleType?: string(name='ruleType', description='The returned result.

This parameter is required.', example='selection'),
  sceneId?: string(name='sceneId', description='The type of the rule.

Valid values: selection and operation.

This parameter is required.', example='xxx'),
}

model DescribeRuleResponseBody = {
  code?: string(name='code', description='The ID of the request.', example='InternalServerError'),
  message?: string(name='message', description='__null__', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The error message.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The error code.', example='2020-04-27T06:38:28.000Z'),
    gmtModified?: string(name='gmtModified', description='The state of the rule.', example='2020-04-27T06:38:28.000Z'),
    ruleId?: string(name='ruleId', description='The time when the rule was last modified.', example='98493A14-D619-4E88-9F8D-108939817F9F'),
    status?: string(name='status', description='The time when the rule was created.', example='DRAFT'),
  }(name='result', description='The ID of the rule.'),
}

model DescribeRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeRuleResponseBody(name='body'),
}

/**
 * @summary The ID of the instance.
 *
 * @param request DescribeRuleRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeRuleResponse
 */
async function describeRuleWithOptions(instanceId: string, ruleId: string, request: DescribeRuleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeRuleResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ruleType)) {
    query['ruleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeRule',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rules/${OpenApiUtil.getEncodeParam(ruleId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the instance.
 *
 * @param request DescribeRuleRequest
 * @return DescribeRuleResponse
 */
async function describeRule(instanceId: string, ruleId: string, request: DescribeRuleRequest): DescribeRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeRuleWithOptions(instanceId, ruleId, request, headers, runtime);
}

model DescribeSceneResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: {
    gmtCreate?: string(name='gmtCreate'),
    gmtModified?: string(name='gmtModified'),
    sceneId?: string(name='sceneId'),
    status?: string(name='status'),
  }(name='result'),
}

model DescribeSceneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSceneResponseBody(name='body'),
}

/**
 * @summary Queries the details about a specified scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSceneResponse
 */
async function describeSceneWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSceneResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeScene',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details about a specified scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @return DescribeSceneResponse
 */
async function describeScene(instanceId: string, sceneId: string): DescribeSceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSceneWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeSceneBucketResponseBody = {
  requestId?: string(name='requestId', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: {
    detail?: map[string]any(name='detail', example='xxx'),
    inUse?: string(name='inUse', example='1'),
    num?: int32(name='num', example='2'),
  }(name='result'),
}

model DescribeSceneBucketResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSceneBucketResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSceneBucketResponse
 */
async function describeSceneBucketWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSceneBucketResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeSceneBucket',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiment-bucket`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return DescribeSceneBucketResponse
 */
async function describeSceneBucket(instanceId: string, sceneId: string): DescribeSceneBucketResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSceneBucketWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeSceneThroughputResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    pvCount?: long(name='pvCount'),
  }(name='result'),
}

model DescribeSceneThroughputResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSceneThroughputResponseBody(name='body'),
}

/**
 * @summary The error message.
 *
 * @description __null__
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSceneThroughputResponse
 */
async function describeSceneThroughputWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSceneThroughputResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DescribeSceneThroughput',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/throughput`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The error message.
 *
 * @description __null__
 *
 * @return DescribeSceneThroughputResponse
 */
async function describeSceneThroughput(instanceId: string, sceneId: string): DescribeSceneThroughputResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSceneThroughputWithOptions(instanceId, sceneId, headers, runtime);
}

model DescribeSyncReportDetailRequest {
  endTime?: long(name='endTime', description='This parameter is required.', example='1586673466'),
  levelType?: string(name='levelType', description='This parameter is required.', example='error'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1586673466'),
  type?: string(name='type', description='This parameter is required.', example='behavior'),
}

model DescribeSyncReportDetailResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      defaultDisplay?: boolean(name='defaultDisplay', example='false'),
      errorCount?: int32(name='errorCount', example='246165'),
      errorPercent?: float(name='errorPercent', example='84.6'),
      historyData?: [ 
        {
          endTime?: long(name='endTime', example='1586673466'),
          errorPercent?: float(name='errorPercent', example='84.6'),
          startTime?: long(name='startTime', example='1586673466'),
        }
      ](name='historyData'),
      sampleDisplay?: boolean(name='sampleDisplay', example='true'),
      type?: string(name='type', example='bhvTimeBehavior'),
    }
  ](name='result'),
}

model DescribeSyncReportDetailResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSyncReportDetailResponseBody(name='body'),
}

/**
 * @param request DescribeSyncReportDetailRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSyncReportDetailResponse
 */
async function describeSyncReportDetailWithOptions(instanceId: string, request: DescribeSyncReportDetailRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSyncReportDetailResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.levelType)) {
    query['levelType'] = request.levelType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSyncReportDetail',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/sync-reports/detail`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeSyncReportDetailRequest
 * @return DescribeSyncReportDetailResponse
 */
async function describeSyncReportDetail(instanceId: string, request: DescribeSyncReportDetailRequest): DescribeSyncReportDetailResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSyncReportDetailWithOptions(instanceId, request, headers, runtime);
}

model DescribeSyncReportOutliersRequest {
  endTime?: long(name='endTime', description='This parameter is required.', example='1586673466'),
  key?: string(name='key', description='This parameter is required.'),
  levelType?: string(name='levelType', description='This parameter is required.'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1586673466'),
  type?: string(name='type', description='This parameter is required.'),
}

model DescribeSyncReportOutliersResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result'),
}

model DescribeSyncReportOutliersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeSyncReportOutliersResponseBody(name='body'),
}

/**
 * @param request DescribeSyncReportOutliersRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeSyncReportOutliersResponse
 */
async function describeSyncReportOutliersWithOptions(instanceId: string, request: DescribeSyncReportOutliersRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeSyncReportOutliersResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.key)) {
    query['key'] = request.key;
  }
  if (!Util.isUnset(request.levelType)) {
    query['levelType'] = request.levelType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeSyncReportOutliers',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/sync-reports/outliers`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request DescribeSyncReportOutliersRequest
 * @return DescribeSyncReportOutliersResponse
 */
async function describeSyncReportOutliers(instanceId: string, request: DescribeSyncReportOutliersRequest): DescribeSyncReportOutliersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeSyncReportOutliersWithOptions(instanceId, request, headers, runtime);
}

model DescribeUserMetricsRequest {
  endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.

This parameter is required.', example='1567155600'),
  metricType?: string(name='metricType', description='The type of the user metric that you want to query. Valid values: pvCtr and uvCtr.

This parameter is required.', example='pvCtr'),
  startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.

This parameter is required.', example='1567152000'),
}

model DescribeUserMetricsResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      dataPoints?: [ 
        {
          endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.', example='1567152000'),
          startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.', example='1567152000'),
          val?: float(name='val', description='The value of the corresponding metric.', example='84.6'),
        }
      ](name='dataPoints', description='The returned metrics.'),
      sceneId?: string(name='sceneId', description='The scene ID.', example='all'),
    }
  ](name='result', description='The returned results.'),
}

model DescribeUserMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DescribeUserMetricsResponseBody(name='body'),
}

/**
 * @summary Queries user metrics related to the conversion rate.
 *
 * @param request DescribeUserMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DescribeUserMetricsResponse
 */
async function describeUserMetricsWithOptions(instanceId: string, request: DescribeUserMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): DescribeUserMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['metricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeUserMetrics',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/metrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries user metrics related to the conversion rate.
 *
 * @param request DescribeUserMetricsRequest
 * @return DescribeUserMetricsResponse
 */
async function describeUserMetrics(instanceId: string, request: DescribeUserMetricsRequest): DescribeUserMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return describeUserMetricsWithOptions(instanceId, request, headers, runtime);
}

model DowngradeInstanceResponseBody = {
  code?: string(name='code', description='The ID of the instance.', example='InternalServerError'),
  message?: string(name='message', description='The ID of the instance.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The returned results.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    instanceId?: string(name='instanceId', description='The new quota must be less than the selected quota.

The limits on the number of users: 1,000,000 to 10,000,000. The limits on the number of items: 1,000,000 to 10,000,000. The limits on the queries per second (QPS) of recommendation requests: 10 to 500.', example='airec-cn-o400whm78004'),
  }(name='result', description='Decreases the quotas of a specified instance.'),
}

model DowngradeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: DowngradeInstanceResponseBody(name='body'),
}

/**
 * @summary The ID of the instance.
 *
 * @description The returned results.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return DowngradeInstanceResponse
 */
async function downgradeInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): DowngradeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'DowngradeInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/actions/downgrade`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the instance.
 *
 * @description The returned results.
 *
 * @return DowngradeInstanceResponse
 */
async function downgradeInstance(instanceId: string): DowngradeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return downgradeInstanceWithOptions(instanceId, headers, runtime);
}

model EnableExperimentResponseBody = {
  requestId?: string(name='requestId', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: boolean(name='result'),
}

model EnableExperimentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: EnableExperimentResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return EnableExperimentResponse
 */
async function enableExperimentWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): EnableExperimentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'EnableExperiment',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/actions/enable-experiment`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return EnableExperimentResponse
 */
async function enableExperiment(instanceId: string, sceneId: string): EnableExperimentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return enableExperimentWithOptions(instanceId, sceneId, headers, runtime);
}

model GenerateSampleResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: Sample(name='result'),
}

model GenerateSampleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GenerateSampleResponseBody(name='body'),
}

/**
 * @summary 生成样本，只针对复制创建的样本
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GenerateSampleResponse
 */
async function generateSampleWithOptions(instanceId: string, sampleId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GenerateSampleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GenerateSample',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}/actions/generate`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 生成样本，只针对复制创建的样本
 *
 * @return GenerateSampleResponse
 */
async function generateSample(instanceId: string, sampleId: string): GenerateSampleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return generateSampleWithOptions(instanceId, sampleId, headers, runtime);
}

model GetExtraDataSourceResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: ExtraDataSource(name='result'),
}

model GetExtraDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetExtraDataSourceResponseBody(name='body'),
}

/**
 * @summary Queries the details of other data sources.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetExtraDataSourceResponse
 */
async function getExtraDataSourceWithOptions(instanceId: string, type: string, dataSourceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetExtraDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetExtraDataSource',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/extra-data-sources/${OpenApiUtil.getEncodeParam(type)}/${OpenApiUtil.getEncodeParam(dataSourceId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the details of other data sources.
 *
 * @return GetExtraDataSourceResponse
 */
async function getExtraDataSource(instanceId: string, type: string, dataSourceId: string): GetExtraDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getExtraDataSourceWithOptions(instanceId, type, dataSourceId, headers, runtime);
}

model GetFlowControlTaskResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: [ 
    {
      gmtCreate?: string(name='gmtCreate', description='The time when the task was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in Coordinated Universal Time (UTC).', example='2018-12-07T02:24:26.000Z'),
      gmtModified?: string(name='gmtModified', description='The time when the data source was last modified. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2020-04-23T06:08:48.000Z'),
      meta?: {
        description?: string(name='description', description='The task description.', example='xx'),
        endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.', example='1656518399'),
        metaType?: string(name='metaType', description='The metadata type.', example='FlowControlTask'),
        sceneIds?: string(name='sceneIds', description='The scene IDs.', example='1,2,3'),
        selectionParams?: [ 
          {
            selectType?: string(name='selectType', description='The type of the filtering condition for the item selection rule.', example='QUERY_PUB_TIME'),
            selectValue?: string(name='selectValue', description='The value of the filtering condition for the item selection rule.', example='10000'),
            selectionOperation?: string(name='selectionOperation', description='The operation on the filtering condition for the item selection rule.', example='OPERATOR_HIGHER'),
          }
        ](name='selectionParams', description='The parameters specified for the item selection rule.'),
        startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.', example='1640739600'),
        target?: {
          type?: string(name='type', description='EXPOSE_PERCENT: daily exposure percentage. EXPOSE_COUNT: total number of exposures.', example='EXPOSE_PERCENT'),
          value?: long(name='value', description='The exposure value.', example='20'),
        }(name='target', description='The exposure settings.'),
        taskName?: string(name='taskName', description='The task name.'),
      }(name='meta', description='The metadata of the task.'),
      status?: string(name='status', description='The task state. Valid values: DRAFT, READY, RUNNING, ENDED, and AUTO_END. The value AUTO_END is not used.', example='DRAFT'),
      taskId?: string(name='taskId', description='The task ID.', example='1666854602398'),
    }
  ](name='result', description='The returned result.'),
}

model GetFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary Obtains the details of a throttling task.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetFlowControlTaskResponse
 */
async function getFlowControlTaskWithOptions(instanceId: string, taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetFlowControlTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Obtains the details of a throttling task.
 *
 * @return GetFlowControlTaskResponse
 */
async function getFlowControlTask(instanceId: string, taskId: string): GetFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getFlowControlTaskWithOptions(instanceId, taskId, headers, runtime);
}

model GetLatestDataDiagnoseTaskStatusResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: map[string]any(name='result', example='RUNNING'),
}

model GetLatestDataDiagnoseTaskStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetLatestDataDiagnoseTaskStatusResponseBody(name='body'),
}

/**
 * @summary 获取最新诊断任务状态
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetLatestDataDiagnoseTaskStatusResponse
 */
async function getLatestDataDiagnoseTaskStatusWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetLatestDataDiagnoseTaskStatusResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetLatestDataDiagnoseTaskStatus',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/data-diagnose-task/status`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取最新诊断任务状态
 *
 * @return GetLatestDataDiagnoseTaskStatusResponse
 */
async function getLatestDataDiagnoseTaskStatus(instanceId: string): GetLatestDataDiagnoseTaskStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getLatestDataDiagnoseTaskStatusWithOptions(instanceId, headers, runtime);
}

model GetRankingModelTemplateResponseBody = {
  requestId?: string(name='requestId'),
  result?: RankingModelTemplate(name='result'),
}

model GetRankingModelTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRankingModelTemplateResponseBody(name='body'),
}

/**
 * @summary 查看排序模型模板配置详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRankingModelTemplateResponse
 */
async function getRankingModelTemplateWithOptions(instanceId: string, templateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetRankingModelTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetRankingModelTemplate',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-templates/${OpenApiUtil.getEncodeParam(templateId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查看排序模型模板配置详情
 *
 * @return GetRankingModelTemplateResponse
 */
async function getRankingModelTemplate(instanceId: string, templateId: string): GetRankingModelTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getRankingModelTemplateWithOptions(instanceId, templateId, headers, runtime);
}

model GetRankingModelVersionResponseBody = {
  requestId?: string(name='requestId'),
  result?: RankingModelVersion(name='result'),
}

model GetRankingModelVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRankingModelVersionResponseBody(name='body'),
}

/**
 * @summary 查看排序模型版本详情，包括评估结果和训练结果
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRankingModelVersionResponse
 */
async function getRankingModelVersionWithOptions(instanceId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetRankingModelVersionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetRankingModelVersion',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-versions/${OpenApiUtil.getEncodeParam(versionId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查看排序模型版本详情，包括评估结果和训练结果
 *
 * @return GetRankingModelVersionResponse
 */
async function getRankingModelVersion(instanceId: string, versionId: string): GetRankingModelVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getRankingModelVersionWithOptions(instanceId, versionId, headers, runtime);
}

model GetRankingSystemResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: RankingSystem(name='result'),
}

model GetRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRankingSystemResponseBody(name='body'),
}

/**
 * @summary 获取某个排序服务详情
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRankingSystemResponse
 */
async function getRankingSystemWithOptions(instanceId: string, name: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetRankingSystemResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取某个排序服务详情
 *
 * @return GetRankingSystemResponse
 */
async function getRankingSystem(instanceId: string, name: string): GetRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getRankingSystemWithOptions(instanceId, name, headers, runtime);
}

model GetRankingSystemHistoryResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: RankingSystemHistory(name='result'),
}

model GetRankingSystemHistoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetRankingSystemHistoryResponseBody(name='body'),
}

/**
 * @summary 查询某个服务操作记录
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetRankingSystemHistoryResponse
 */
async function getRankingSystemHistoryWithOptions(instanceId: string, name: string, operateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): GetRankingSystemHistoryResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'GetRankingSystemHistory',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}/histories/${OpenApiUtil.getEncodeParam(operateId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询某个服务操作记录
 *
 * @return GetRankingSystemHistoryResponse
 */
async function getRankingSystemHistory(instanceId: string, name: string, operateId: string): GetRankingSystemHistoryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getRankingSystemHistoryWithOptions(instanceId, name, operateId, headers, runtime);
}

model GetSampleRequest {
  withExtendParmas?: boolean(name='withExtendParmas', example='true'),
}

model GetSampleResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: Sample(name='result'),
}

model GetSampleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: GetSampleResponseBody(name='body'),
}

/**
 * @summary 获取样本详情
 *
 * @param request GetSampleRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return GetSampleResponse
 */
async function getSampleWithOptions(instanceId: string, sampleId: string, request: GetSampleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): GetSampleResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.withExtendParmas)) {
    query['withExtendParmas'] = request.withExtendParmas;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetSample',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取样本详情
 *
 * @param request GetSampleRequest
 * @return GetSampleResponse
 */
async function getSample(instanceId: string, sampleId: string, request: GetSampleRequest): GetSampleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return getSampleWithOptions(instanceId, sampleId, request, headers, runtime);
}

model InitComputingResourceRequest {
  key?: string(name='key', example='MAX_COMPUTE'),
  type?: string(name='type', example='MAX_COMPUTE'),
}

model InitComputingResourceResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
}

model InitComputingResourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: InitComputingResourceResponseBody(name='body'),
}

/**
 * @summary 初始化计算资源
 *
 * @param request InitComputingResourceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return InitComputingResourceResponse
 */
async function initComputingResourceWithOptions(instanceId: string, request: InitComputingResourceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): InitComputingResourceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.key)) {
    query['key'] = request.key;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'InitComputingResource',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/computing-resources/actions/init`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 初始化计算资源
 *
 * @param request InitComputingResourceRequest
 * @return InitComputingResourceResponse
 */
async function initComputingResource(instanceId: string, request: InitComputingResourceRequest): InitComputingResourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return initComputingResourceWithOptions(instanceId, request, headers, runtime);
}

model ListDashboardDetailsRequest {
  endTime?: long(name='endTime', description='This parameter is required.', example='1588521600'),
  experimentIds?: string(name='experimentIds', example='all'),
  matchTypes?: string(name='matchTypes', example='hot,emb,u2x2i,hilp,new,'),
  metricType?: string(name='metricType', description='This parameter is required.', example='xxx'),
  sceneIds?: string(name='sceneIds', description='This parameter is required.', example='test'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1588521600'),
  traceIds?: string(name='traceIds', description='This parameter is required.', example='Alibaba'),
}

model ListDashboardDetailsResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      metricRes?: {
        detail?: map[string]any(name='detail', example='xxx'),
        total?: map[string]any(name='total', example='xxx'),
      }(name='metricRes'),
      sceneId?: string(name='sceneId', example='test'),
      traceId?: string(name='traceId', example='Alibaba'),
    }
  ](name='result'),
}

model ListDashboardDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDashboardDetailsResponseBody(name='body'),
}

/**
 * @param request ListDashboardDetailsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDashboardDetailsResponse
 */
async function listDashboardDetailsWithOptions(instanceId: string, request: ListDashboardDetailsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardDetailsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.experimentIds)) {
    query['experimentIds'] = request.experimentIds;
  }
  if (!Util.isUnset(request.matchTypes)) {
    query['matchTypes'] = request.matchTypes;
  }
  if (!Util.isUnset(request.metricType)) {
    query['metricType'] = request.metricType;
  }
  if (!Util.isUnset(request.sceneIds)) {
    query['sceneIds'] = request.sceneIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceIds)) {
    query['traceIds'] = request.traceIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardDetails',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/details`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListDashboardDetailsRequest
 * @return ListDashboardDetailsResponse
 */
async function listDashboardDetails(instanceId: string, request: ListDashboardDetailsRequest): ListDashboardDetailsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardDetailsWithOptions(instanceId, request, headers, runtime);
}

model ListDashboardDetailsFlowsRequest {
  endTime?: long(name='endTime', description='This parameter is required.', example='1588521600'),
  experimentIds?: string(name='experimentIds', example='all'),
  metricType?: string(name='metricType', description='This parameter is required.', example='USERACTIONUV_COUNT'),
  sceneIds?: string(name='sceneIds', description='This parameter is required.', example='test'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1588521600'),
  traceIds?: string(name='traceIds', description='This parameter is required.', example='Alibaba'),
}

model ListDashboardDetailsFlowsResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    metricData?: [ 
      {
        metricRes?: map[string]any(name='metricRes', example='xxx'),
        sceneId?: string(name='sceneId', example='test'),
        traceId?: string(name='traceId', example='Alibaba'),
      }
    ](name='metricData'),
    metricType?: string(name='metricType', example='USERACTIONUV_COUNT'),
  }(name='result'),
}

model ListDashboardDetailsFlowsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDashboardDetailsFlowsResponseBody(name='body'),
}

/**
 * @param request ListDashboardDetailsFlowsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDashboardDetailsFlowsResponse
 */
async function listDashboardDetailsFlowsWithOptions(instanceId: string, request: ListDashboardDetailsFlowsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardDetailsFlowsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.experimentIds)) {
    query['experimentIds'] = request.experimentIds;
  }
  if (!Util.isUnset(request.metricType)) {
    query['metricType'] = request.metricType;
  }
  if (!Util.isUnset(request.sceneIds)) {
    query['sceneIds'] = request.sceneIds;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceIds)) {
    query['traceIds'] = request.traceIds;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardDetailsFlows',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/details/flows`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListDashboardDetailsFlowsRequest
 * @return ListDashboardDetailsFlowsResponse
 */
async function listDashboardDetailsFlows(instanceId: string, request: ListDashboardDetailsFlowsRequest): ListDashboardDetailsFlowsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardDetailsFlowsWithOptions(instanceId, request, headers, runtime);
}

model ListDashboardMetricsRequest {
  endTime?: long(name='endTime', description='The statistical results.

This parameter is required.', example='1586673466'),
  metricQuery?: string(name='metricQuery'),
  metricType?: string(name='metricType', description='The statistical results.', example='The details about the metric.'),
  metricView?: string(name='metricView'),
  startTime?: long(name='startTime', description='USERACTIONPV_COUNT

This parameter is required.', example='1586673466'),
}

model ListDashboardMetricsResponseBody = {
  code?: string(name='code', description='__null__', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      detail?: [ 
        {
          endTime?: string(name='endTime', description='The error message.', example='1586673466'),
          startTime?: string(name='startTime', description='The ID of the request.', example='1586673466'),
          val?: string(name='val', description='The error code.', example='13'),
        }
      ](name='detail', description='The end time. The value is a timestamp in seconds.'),
      total?: map[string]any(name='total', description='The start time. The value is a timestamp in seconds.', example='xxx'),
    }
  ](name='result', description='The specific value of the metric.'),
}

model ListDashboardMetricsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDashboardMetricsResponseBody(name='body'),
}

/**
 * @summary The end time. The value is a timestamp in seconds.
 *
 * @param request ListDashboardMetricsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDashboardMetricsResponse
 */
async function listDashboardMetricsWithOptions(instanceId: string, request: ListDashboardMetricsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardMetricsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricQuery)) {
    query['metricQuery'] = request.metricQuery;
  }
  if (!Util.isUnset(request.metricType)) {
    query['metricType'] = request.metricType;
  }
  if (!Util.isUnset(request.metricView)) {
    query['metricView'] = request.metricView;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardMetrics',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/metrics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The end time. The value is a timestamp in seconds.
 *
 * @param request ListDashboardMetricsRequest
 * @return ListDashboardMetricsResponse
 */
async function listDashboardMetrics(instanceId: string, request: ListDashboardMetricsRequest): ListDashboardMetricsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardMetricsWithOptions(instanceId, request, headers, runtime);
}

model ListDashboardMetricsFlowsRequest {
  endTime?: long(name='endTime', description='The type of the metric.

This parameter is required.', example='1586673466'),
  metricType?: string(name='metricType', description='The metric data.

This parameter is required.', example='The error code.'),
  startTime?: long(name='startTime', description='The statistical results.

This parameter is required.', example='1586673466'),
}

model ListDashboardMetricsFlowsResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      metricData?: map[string]any(name='metricData', description='__null__', example='xxx'),
      metricType?: string(name='metricType', description='The error message.', example='xxx'),
    }
  ](name='result', description='The ID of the request.'),
}

model ListDashboardMetricsFlowsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDashboardMetricsFlowsResponseBody(name='body'),
}

/**
 * @summary The end time. The value is a timestamp in seconds.
 *
 * @param request ListDashboardMetricsFlowsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDashboardMetricsFlowsResponse
 */
async function listDashboardMetricsFlowsWithOptions(instanceId: string, request: ListDashboardMetricsFlowsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDashboardMetricsFlowsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metricType)) {
    query['metricType'] = request.metricType;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDashboardMetricsFlows',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/metrics/flows`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The end time. The value is a timestamp in seconds.
 *
 * @param request ListDashboardMetricsFlowsRequest
 * @return ListDashboardMetricsFlowsResponse
 */
async function listDashboardMetricsFlows(instanceId: string, request: ListDashboardMetricsFlowsRequest): ListDashboardMetricsFlowsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDashboardMetricsFlowsWithOptions(instanceId, request, headers, runtime);
}

model ListDataDiagnoseReportsRequest {
  taskCreateTime?: long(name='taskCreateTime', example='1566489600'),
}

model ListDataDiagnoseReportsResponseBody = {
  requestId?: string(name='requestId', description='Id of the request', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: map[string]any(name='result', example='{
    "todayTimeLimit":8,
    "totalCount":10,
    "reports":[
        {
            "diagnoseLevel":"low | medium | high",
            "startTime":1566489600,
            "endTime":1566489600,
            "taskCreateTime":1566489600,
            "taskSource":"manual | cycle | firstRun",
            "total":{
                "itemCount":100,
                "userCount":100,
                "bhvCount":100
            },
            "details":[
                {
                    "key":"",
                    "level":"error | warn | info",
                    "errorCount":10,
                    "errorPercent":10,
                    "sampleEnabled":true;
                }
            ]
        },
        {
            "diagnoseLevel":"low | medium | high",
            "startTime":1566489600,
            "endTime":1566489600,
            "taskCreateTime":1566489600,
            "taskSource":"manual | cycle | firstRun",
            "total":{
                "itemCount":100,
                "userCount":100,
                "bhvCount":100
            },
            "details":[
                {
                    "key":"",
                    "level":"error | warn | info",
                    "errorCount":10,
                    "errorPercent":10,
                    "sampleEnabled":true;
                }
            ]
        }
    ]
}'),
}

model ListDataDiagnoseReportsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDataDiagnoseReportsResponseBody(name='body'),
}

/**
 * @summary 获取数据诊断报告 (包括用户手动触发的诊断、每天产出的周期报告、数据启动时诊断的报告)
 *
 * @param request ListDataDiagnoseReportsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDataDiagnoseReportsResponse
 */
async function listDataDiagnoseReportsWithOptions(instanceId: string, request: ListDataDiagnoseReportsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataDiagnoseReportsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.taskCreateTime)) {
    query['taskCreateTime'] = request.taskCreateTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDataDiagnoseReports',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/data-diagnose-reports`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取数据诊断报告 (包括用户手动触发的诊断、每天产出的周期报告、数据启动时诊断的报告)
 *
 * @param request ListDataDiagnoseReportsRequest
 * @return ListDataDiagnoseReportsResponse
 */
async function listDataDiagnoseReports(instanceId: string, request: ListDataDiagnoseReportsRequest): ListDataDiagnoseReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataDiagnoseReportsWithOptions(instanceId, request, headers, runtime);
}

model ListDataDiagnoseSampleDetailsRequest {
  endTime?: long(name='endTime', description='This parameter is required.', example='1682179200'),
  key?: string(name='key', description='This parameter is required.'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1665158400'),
  taskCreateTime?: long(name='taskCreateTime', description='This parameter is required.', example='1665936000000'),
  taskSource?: string(name='taskSource', description='This parameter is required.', example='cycle'),
}

model ListDataDiagnoseSampleDetailsResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: map[string]any(name='result'),
}

model ListDataDiagnoseSampleDetailsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDataDiagnoseSampleDetailsResponseBody(name='body'),
}

/**
 * @summary 获取数据诊断项抽样明细
 *
 * @param request ListDataDiagnoseSampleDetailsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDataDiagnoseSampleDetailsResponse
 */
async function listDataDiagnoseSampleDetailsWithOptions(instanceId: string, request: ListDataDiagnoseSampleDetailsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataDiagnoseSampleDetailsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.key)) {
    query['key'] = request.key;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.taskCreateTime)) {
    query['taskCreateTime'] = request.taskCreateTime;
  }
  if (!Util.isUnset(request.taskSource)) {
    query['taskSource'] = request.taskSource;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListDataDiagnoseSampleDetails',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/data-diagnose-reports/sample-details`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取数据诊断项抽样明细
 *
 * @param request ListDataDiagnoseSampleDetailsRequest
 * @return ListDataDiagnoseSampleDetailsResponse
 */
async function listDataDiagnoseSampleDetails(instanceId: string, request: ListDataDiagnoseSampleDetailsRequest): ListDataDiagnoseSampleDetailsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataDiagnoseSampleDetailsWithOptions(instanceId, request, headers, runtime);
}

model ListDataSetResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the request.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      gmtCreate?: long(name='gmtCreate', description='The time when the data source was created.', example='1544112000000'),
      gmtModified?: long(name='gmtModified', description='The time when the data source was last modified.', example='1544112000000'),
      instanceId?: string(name='instanceId', description='The ID of the instance.', example='airec-cn-o400whm78004'),
      state?: string(name='state', description='The state for the dataset of the current version. Example: Importing. The value indicates that the dataset of the current version is being imported.', example='Importing'),
      versionId?: string(name='versionId', description='The version number of the dataset.', example='20181023214546'),
    }
  ](name='result', description='The returned datasets.'),
}

model ListDataSetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDataSetResponseBody(name='body'),
}

/**
 * @summary Queries datasets of a specified instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDataSetResponse
 */
async function listDataSetWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataSetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDataSet',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSets`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries datasets of a specified instance.
 *
 * @return ListDataSetResponse
 */
async function listDataSet(instanceId: string): ListDataSetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataSetWithOptions(instanceId, headers, runtime);
}

model ListDataSourceResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      gmtCreate?: string(name='gmtCreate', example='2018-12-07T02:24:26.000Z'),
      gmtModified?: string(name='gmtModified', example='2018-12-07T02:24:26.000Z'),
      meta?: {
        accessKeyId?: string(name='accessKeyId', example='xxx'),
        bucketName?: string(name='bucketName', example='airec'),
        partition?: string(name='partition', example='ds=20181122'),
        path?: string(name='path', example='oss://xxx.xxx'),
        projectName?: string(name='projectName', example='openrec_gray'),
        tableName?: string(name='tableName', example='test_maxcompute'),
        timestamp?: long(name='timestamp', example='1544112000000'),
        type?: string(name='type', example='ODPS'),
      }(name='meta'),
      tableName?: string(name='tableName', example='behavior'),
    }
  ](name='result'),
}

model ListDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListDataSourceResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListDataSourceResponse
 */
async function listDataSourceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListDataSource',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ListDataSourceResponse
 */
async function listDataSource(instanceId: string): ListDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listDataSourceWithOptions(instanceId, headers, runtime);
}

model ListExperimentsResponseBody = {
  requestId?: string(name='requestId', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: [ 
    {
      base?: boolean(name='base', example='true'),
      buckets?: [ string ](name='buckets'),
      description?: string(name='description', example='xxx'),
      experimentId?: string(name='experimentId', example='123'),
      name?: string(name='name', example='test'),
      offlineTime?: string(name='offlineTime', example='2020-12-07T06:47:30.000Z'),
      onlineTime?: string(name='onlineTime', example='2020-12-07T06:47:30.000Z'),
      status?: string(name='status', example='init'),
    }
  ](name='result'),
}

model ListExperimentsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExperimentsResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExperimentsResponse
 */
async function listExperimentsWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListExperimentsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListExperiments',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ListExperimentsResponse
 */
async function listExperiments(instanceId: string, sceneId: string): ListExperimentsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listExperimentsWithOptions(instanceId, sceneId, headers, runtime);
}

model ListExtraDataSourcesRequest {
  type?: string(name='type', example='UserCustomDataSource ItemCustomDataSource BehaviorCustomDataSource SampleCustomDataSource'),
}

model ListExtraDataSourcesResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: [
    ExtraDataSource
  ](name='result'),
}

model ListExtraDataSourcesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListExtraDataSourcesResponseBody(name='body'),
}

/**
 * @summary 获取特征、样本等表扩展数据源列表
 *
 * @param request ListExtraDataSourcesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListExtraDataSourcesResponse
 */
async function listExtraDataSourcesWithOptions(instanceId: string, request: ListExtraDataSourcesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListExtraDataSourcesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListExtraDataSources',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/extra-data-sources`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取特征、样本等表扩展数据源列表
 *
 * @param request ListExtraDataSourcesRequest
 * @return ListExtraDataSourcesResponse
 */
async function listExtraDataSources(instanceId: string, request: ListExtraDataSourcesRequest): ListExtraDataSourcesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listExtraDataSourcesWithOptions(instanceId, request, headers, runtime);
}

model ListFeatureTablesRequest {
  dataSourceId?: string(name='dataSourceId', example='1'),
  type?: string(name='type', example='UserFeatureTable'),
  updateFrequency?: string(name='updateFrequency', example='1'),
}

model ListFeatureTablesResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: [
    FeatureTable
  ](name='result', example='result'),
}

model ListFeatureTablesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFeatureTablesResponseBody(name='body'),
}

/**
 * @summary 获取特征表列表
 *
 * @param request ListFeatureTablesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFeatureTablesResponse
 */
async function listFeatureTablesWithOptions(instanceId: string, request: ListFeatureTablesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFeatureTablesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.dataSourceId)) {
    query['dataSourceId'] = request.dataSourceId;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }
  if (!Util.isUnset(request.updateFrequency)) {
    query['updateFrequency'] = request.updateFrequency;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFeatureTables',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/feature-tables`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取特征表列表
 *
 * @param request ListFeatureTablesRequest
 * @return ListFeatureTablesResponse
 */
async function listFeatureTables(instanceId: string, request: ListFeatureTablesRequest): ListFeatureTablesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFeatureTablesWithOptions(instanceId, request, headers, runtime);
}

model ListFilteringAlgorithmsRequest {
  algorithmId?: string(name='algorithmId', example='123'),
  page?: int32(name='page', example='1'),
  size?: int32(name='size', example='1'),
  status?: string(name='status', example='Running'),
}

model ListFilteringAlgorithmsResponseBody = {
  headers?: {
    xTotalCount?: int32(name='X-Total-Count', example='12'),
  }(name='headers'),
  requestId?: string(name='requestId', example='7585C2B2-0D61-4C96-AC5D-B960BFEDD4A3'),
  result?: [ 
    {
      algorithmId?: string(name='algorithmId', example='123'),
      gmtCreate?: string(name='gmtCreate', example='2018-12-07T02:24:26.000Z'),
      gmtModified?: string(name='gmtModified', example='2018-12-07T02:24:26.000Z'),
      meta?: {
        algorithmName?: string(name='algorithmName', example='test'),
        category?: string(name='category', example='odps'),
        clusterId?: string(name='clusterId', example='123'),
        cron?: string(name='cron', example='0 0/12 0 * *'),
        cronEnabled?: boolean(name='cronEnabled', example='true'),
        description?: string(name='description', example='test'),
        extInfo?: {
          itemSeparator?: string(name='itemSeparator', example=','),
          kvSeparator?: string(name='kvSeparator', example=':'),
        }(name='extInfo'),
        metaType?: string(name='metaType', example='ODPS'),
        projectName?: string(name='projectName', example='airec123'),
        tableName?: string(name='tableName', example='item'),
        taskId?: string(name='taskId', example='123'),
        threshold?: {
          indexLossThreshold?: int32(name='indexLossThreshold', example='1'),
          indexSizeThreshold?: int32(name='indexSizeThreshold', example='1'),
          sourceDataRecordThreshold?: int32(name='sourceDataRecordThreshold', example='1'),
          sourceDataSizeThreshold?: int32(name='sourceDataSizeThreshold', example='1'),
        }(name='threshold'),
        type?: string(name='type', example='odps'),
      }(name='meta'),
      status?: string(name='status', example='Running'),
    }
  ](name='result'),
}

model ListFilteringAlgorithmsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFilteringAlgorithmsResponseBody(name='body'),
}

/**
 * @param request ListFilteringAlgorithmsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFilteringAlgorithmsResponse
 */
async function listFilteringAlgorithmsWithOptions(instanceId: string, request: ListFilteringAlgorithmsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFilteringAlgorithmsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.algorithmId)) {
    query['algorithmId'] = request.algorithmId;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFilteringAlgorithms',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListFilteringAlgorithmsRequest
 * @return ListFilteringAlgorithmsResponse
 */
async function listFilteringAlgorithms(instanceId: string, request: ListFilteringAlgorithmsRequest): ListFilteringAlgorithmsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFilteringAlgorithmsWithOptions(instanceId, request, headers, runtime);
}

model ListFlowControlTaskRequest {
  page?: int32(name='page', example='1'),
  size?: int32(name='size', example='10'),
  status?: string(name='status', example='DRAFT'),
  taskId?: string(name='taskId', example='1661506482'),
}

model ListFlowControlTaskResponseBody = {
  requestId?: string(name='requestId', example='6E427B10-30FC-1873-922F-FC176D3398D4'),
  result?: [ 
    {
      taskId?: string(name='TaskId', example='1661506482'),
      gmtCreate?: string(name='gmtCreate', example='2022-08-06T06:14:01.000Z'),
      gmtModified?: string(name='gmtModified', example='2022-08-06T06:14:01.000Z'),
      meta?: {
        description?: string(name='description'),
        endTime?: long(name='endTime', example='1621267200'),
        metaType?: string(name='metaType', example='metaType'),
        sceneIds?: string(name='sceneIds', example='1,2,3'),
        selectionParams?: [ 
          {
            selectType?: string(name='selectType', example='selectType'),
            selectValue?: string(name='selectValue', example='selectValue'),
            selectionOperation?: string(name='selectionOperation', example='selectionOperation'),
          }
        ](name='selectionParams'),
        startTime?: long(name='startTime', example='1621267200'),
        target?: {
          type?: string(name='type', example='EXPOSE_PERCENT'),
          value?: long(name='value', example='50'),
        }(name='target'),
        taskName?: string(name='taskName', example='testtaskname'),
      }(name='meta'),
      status?: string(name='status', example='DRAFT'),
    }
  ](name='result'),
}

model ListFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary 查询流控任务列表
 *
 * @param request ListFlowControlTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowControlTaskResponse
 */
async function listFlowControlTaskWithOptions(instanceId: string, request: ListFlowControlTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFlowControlTaskResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }
  if (!Util.isUnset(request.taskId)) {
    query['taskId'] = request.taskId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询流控任务列表
 *
 * @param request ListFlowControlTaskRequest
 * @return ListFlowControlTaskResponse
 */
async function listFlowControlTask(instanceId: string, request: ListFlowControlTaskRequest): ListFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFlowControlTaskWithOptions(instanceId, request, headers, runtime);
}

model ListFlowControlTaskInvalidItemsRequest {
  body?: [ string ](name='body'),
}

model ListFlowControlTaskInvalidItemsResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      invalidItems?: [ 
        {
          itemId?: string(name='itemId', example='287723'),
          itemType?: string(name='itemType', example='video'),
        }
      ](name='invalidItems'),
    }
  ](name='result'),
}

model ListFlowControlTaskInvalidItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowControlTaskInvalidItemsResponseBody(name='body'),
}

/**
 * @summary 查询失效物品 id_type
 *
 * @param request ListFlowControlTaskInvalidItemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowControlTaskInvalidItemsResponse
 */
async function listFlowControlTaskInvalidItemsWithOptions(instanceId: string, taskId: string, request: ListFlowControlTaskInvalidItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFlowControlTaskInvalidItemsResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = request.body,
  };
  var params = new OpenApi.Params{
    action = 'ListFlowControlTaskInvalidItems',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/invalidItems`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 查询失效物品 id_type
 *
 * @param request ListFlowControlTaskInvalidItemsRequest
 * @return ListFlowControlTaskInvalidItemsResponse
 */
async function listFlowControlTaskInvalidItems(instanceId: string, taskId: string, request: ListFlowControlTaskInvalidItemsRequest): ListFlowControlTaskInvalidItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFlowControlTaskInvalidItemsWithOptions(instanceId, taskId, request, headers, runtime);
}

model ListFlowControlTaskItemReportsRequest {
  count?: string(name='count', example='5'),
  selectTimeType?: string(name='selectTimeType', example='yesterDay'),
  selectType?: string(name='selectType', example='invalidItem'),
}

model ListFlowControlTaskItemReportsResponseBody = {
  requestId?: string(name='requestId', example='D486768B-8BF8-4D80-B491-43DC3D0AF8AB'),
  result?: {
    detail?: [ 
      {
        accClickPercent?: string(name='accClickPercent', example='3.24'),
        accItemClick?: string(name='accItemClick', example='1000'),
        accItemCtr?: string(name='accItemCtr', example='4.56'),
        accItemPv?: string(name='accItemPv', example='500'),
        accPvPercent?: string(name='accPvPercent', example='20.12'),
        accTaskClick?: string(name='accTaskClick', example='600'),
        accTaskCtr?: string(name='accTaskCtr', example='3.22'),
        accTaskPv?: string(name='accTaskPv', example='200'),
        accTaskRank?: string(name='accTaskRank', example='10'),
        clickPercent?: string(name='clickPercent', example='1.23'),
        itemClick?: string(name='itemClick', example='100'),
        itemCtr?: string(name='itemCtr', example='2.34'),
        itemId?: string(name='itemId', example='123'),
        itemPv?: string(name='itemPv', example='100'),
        itemType?: string(name='itemType', example='video'),
        pvPercent?: string(name='pvPercent', example='10.12'),
        taskClick?: string(name='taskClick', example='100'),
        taskCtr?: string(name='taskCtr', example='1.23'),
        taskId?: string(name='taskId', example='1666669577221'),
        taskPv?: string(name='taskPv', example='50'),
        taskRank?: string(name='taskRank', example='12'),
      }
    ](name='detail'),
  }(name='result'),
}

model ListFlowControlTaskItemReportsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowControlTaskItemReportsResponseBody(name='body'),
}

/**
 * @summary 流量调控曝光排名物品/失效物品查询
 *
 * @param request ListFlowControlTaskItemReportsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowControlTaskItemReportsResponse
 */
async function listFlowControlTaskItemReportsWithOptions(instanceId: string, taskId: string, request: ListFlowControlTaskItemReportsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFlowControlTaskItemReportsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.count)) {
    query['count'] = request.count;
  }
  if (!Util.isUnset(request.selectTimeType)) {
    query['selectTimeType'] = request.selectTimeType;
  }
  if (!Util.isUnset(request.selectType)) {
    query['selectType'] = request.selectType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFlowControlTaskItemReports',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/itemReports`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 流量调控曝光排名物品/失效物品查询
 *
 * @param request ListFlowControlTaskItemReportsRequest
 * @return ListFlowControlTaskItemReportsResponse
 */
async function listFlowControlTaskItemReports(instanceId: string, taskId: string, request: ListFlowControlTaskItemReportsRequest): ListFlowControlTaskItemReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFlowControlTaskItemReportsWithOptions(instanceId, taskId, request, headers, runtime);
}

model ListFlowControlTaskItemsRequest {
  page?: int32(name='page', example='1'),
  size?: int32(name='size', example='10'),
}

model ListFlowControlTaskItemsResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    detail?: [ 
      {
        author?: string(name='author', example='zhangsan'),
        categoryPath?: string(name='categoryPath', example='12_34'),
        channel?: string(name='channel', example='news'),
        duration?: string(name='duration', example='18'),
        expireTime?: string(name='expireTime', example='1612687809'),
        itemId?: string(name='itemId', example='123'),
        itemType?: string(name='itemType', example='video'),
        lastModifyTime?: string(name='lastModifyTime', example='1662346558'),
        pubTime?: string(name='pubTime', example='1661931487'),
        status?: string(name='status', example='1'),
        title?: string(name='title', example='test'),
        weight?: string(name='weight', example='10'),
      }
    ](name='detail'),
    totalCount?: string(name='totalCount', example='1'),
    validCount?: string(name='validCount', example='1'),
  }(name='result'),
}

model ListFlowControlTaskItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowControlTaskItemsResponseBody(name='body'),
}

/**
 * @summary 流量调控预览
 *
 * @param request ListFlowControlTaskItemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowControlTaskItemsResponse
 */
async function listFlowControlTaskItemsWithOptions(instanceId: string, taskId: string, request: ListFlowControlTaskItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFlowControlTaskItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFlowControlTaskItems',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/actions/items`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 流量调控预览
 *
 * @param request ListFlowControlTaskItemsRequest
 * @return ListFlowControlTaskItemsResponse
 */
async function listFlowControlTaskItems(instanceId: string, taskId: string, request: ListFlowControlTaskItemsRequest): ListFlowControlTaskItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFlowControlTaskItemsWithOptions(instanceId, taskId, request, headers, runtime);
}

model ListFlowControlTaskReferenceResponseBody = {
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This helps troubleshoot issues later.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    last7PvPercent?: double(name='last7PvPercent', description='The average exposure rate of the item pool in the last seven days.', example='0.1'),
    last7ScenePv?: double(name='last7ScenePv', description='The average number of exposures for the items in the selected scene in the last seven days.', example='10'),
    last7TaskPv?: double(name='last7TaskPv', description='The average number of exposures for the item pool in the selected scene in the last seven days.', example='10'),
    lastPvPercent?: double(name='lastPvPercent', description='The exposure rate of the item pool yesterday.', example='0.1'),
    lastScenePv?: long(name='lastScenePv', description='The total number of exposures for the items in the selected scene yesterday.', example='10'),
    lastTaskPv?: long(name='lastTaskPv', description='The number of exposures for the item pool in the selected scene yesterday.', example='10'),
    referenceId?: string(name='referenceId', description='The ID of the reference data.', example='421351235918'),
  }(name='result', description='The returned results.'),
}

model ListFlowControlTaskReferenceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowControlTaskReferenceResponseBody(name='body'),
}

/**
 * @summary Queries reference data for throttling.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowControlTaskReferenceResponse
 */
async function listFlowControlTaskReferenceWithOptions(instanceId: string, taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListFlowControlTaskReferenceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListFlowControlTaskReference',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/reference`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries reference data for throttling.
 *
 * @return ListFlowControlTaskReferenceResponse
 */
async function listFlowControlTaskReference(instanceId: string, taskId: string): ListFlowControlTaskReferenceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFlowControlTaskReferenceWithOptions(instanceId, taskId, headers, runtime);
}

model ListFlowControlTaskReportsRequest {
  endTime?: string(name='endTime', example='1668268800'),
  startTime?: string(name='startTime', example='1666195200'),
}

model ListFlowControlTaskReportsResponseBody = {
  requestId?: string(name='requestId', example='16B78383-2803-4964-9605-37B30C073B0E'),
  result?: {
    metrics?: [ 
      {
        details?: [ 
          {
            endTime?: long(name='endTime', example='1664035200'),
            startTime?: long(name='startTime', example='1664000452'),
            val?: long(name='val', example='0'),
          }
        ](name='details'),
        type?: string(name='type', example='taskPv'),
      }
    ](name='metrics'),
    total?: {
      invalidPercent?: double(name='InvalidPercent', example='0.3'),
      accTaskCtr?: double(name='accTaskCtr', example='0.1'),
      accTaskPv?: long(name='accTaskPv', example='1000'),
      accTotalCtr?: double(name='accTotalCtr', example='0.2'),
    }(name='total'),
  }(name='result'),
}

model ListFlowControlTaskReportsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListFlowControlTaskReportsResponseBody(name='body'),
}

/**
 * @summary 流量调控任务曝光分析
 *
 * @param request ListFlowControlTaskReportsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListFlowControlTaskReportsResponse
 */
async function listFlowControlTaskReportsWithOptions(instanceId: string, taskId: string, request: ListFlowControlTaskReportsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListFlowControlTaskReportsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListFlowControlTaskReports',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/flowTaskReports`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 流量调控任务曝光分析
 *
 * @param request ListFlowControlTaskReportsRequest
 * @return ListFlowControlTaskReportsResponse
 */
async function listFlowControlTaskReports(instanceId: string, taskId: string, request: ListFlowControlTaskReportsRequest): ListFlowControlTaskReportsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listFlowControlTaskReportsWithOptions(instanceId, taskId, request, headers, runtime);
}

model ListIndexVersionsResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: [ 
    {
      builtTime?: string(name='builtTime', example='2020-11-08T02:00:00Z'),
      code?: string(name='code', example='abc'),
      costSeconds?: int32(name='costSeconds', example='600'),
      flowType?: string(name='flowType', example='Auto'),
      message?: string(name='message', example='xxx'),
      progress?: int32(name='progress', example='80'),
      rollbackEnabled?: boolean(name='rollbackEnabled', example='true'),
      size?: long(name='size', example='300922211'),
      status?: string(name='status', example='abc'),
      switchedTime?: string(name='switchedTime', example='2020-11-08T02:00:00Z'),
      versionId?: string(name='versionId', example='2020112301'),
    }
  ](name='result'),
}

model ListIndexVersionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListIndexVersionsResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListIndexVersionsResponse
 */
async function listIndexVersionsWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListIndexVersionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListIndexVersions',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/index-versions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ListIndexVersionsResponse
 */
async function listIndexVersions(instanceId: string, algorithmId: string): ListIndexVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listIndexVersionsWithOptions(instanceId, algorithmId, headers, runtime);
}

model ListInstanceRequest {
  expiredTime?: string(name='expiredTime', description='The state of the instance. Valid values: Running, Ready, Initializing, and Starting.', example='1608533404'),
  instanceId?: string(name='instanceId', description='The name of the instance. Fuzzy match is supported.', example='Test instance'),
  name?: string(name='name', description='The number of the page to return. Default value: 1.', example='The number of entries to return on each page. Valid values: 1 to 50. Default value: 10.'),
  page?: int32(name='page', description='GET /openapi/instances?name=test&instanceId=abc&page=1&size=10', example='1'),
  size?: int32(name='size'),
  status?: string(name='status'),
}

model ListInstanceResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: [ 
    {
      chargeType?: string(name='chargeType'),
      commodityCode?: string(name='commodityCode'),
      dataSetVersion?: string(name='dataSetVersion'),
      expiredTime?: string(name='expiredTime'),
      gmtCreate?: string(name='gmtCreate'),
      gmtModified?: string(name='gmtModified'),
      industry?: string(name='industry'),
      instanceId?: string(name='instanceId'),
      lockMode?: string(name='lockMode'),
      name?: string(name='name'),
      regionId?: string(name='regionId'),
      status?: string(name='status'),
      type?: string(name='type'),
    }
  ](name='result'),
}

model ListInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceResponseBody(name='body'),
}

/**
 * @summary Queries the information of instances.
 *
 * @description You can call this API operation to query the list of instances. The returned instances are ranked in descending order based on the values of GmtCreate. You can specify multiple request parameters. These request parameters can be used to filter query results. The request parameters that you specify have logical AND relations. Only the specified parameters can be used to filter query results.
 *
 * @param request ListInstanceRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceResponse
 */
async function listInstanceWithOptions(request: ListInstanceRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.expiredTime)) {
    query['expiredTime'] = request.expiredTime;
  }
  if (!Util.isUnset(request.instanceId)) {
    query['instanceId'] = request.instanceId;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the information of instances.
 *
 * @description You can call this API operation to query the list of instances. The returned instances are ranked in descending order based on the values of GmtCreate. You can specify multiple request parameters. These request parameters can be used to filter query results. The request parameters that you specify have logical AND relations. Only the specified parameters can be used to filter query results.
 *
 * @param request ListInstanceRequest
 * @return ListInstanceResponse
 */
async function listInstance(request: ListInstanceRequest): ListInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceWithOptions(request, headers, runtime);
}

model ListInstanceTaskResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      name?: string(name='name', description='The name of the step. Example: DATA_IMPORT. The value indicates that data is being imported.', example='DATA_IMPORT'),
      subProgressInfos?: [ 
        {
          detail?: string(name='detail', description='The detailed description of subtasks.', example='data import progress info'),
          finishedNum?: int32(name='finishedNum', description='The number of completed subtasks.', example='11'),
          progress?: int32(name='progress', description='The progress of subtasks.', example='100'),
          totalNum?: int32(name='totalNum', description='The total number of subtasks.', example='11'),
          type?: string(name='type', description='The type of subtasks.', example='DATA_PROCESS'),
        }
      ](name='subProgressInfos', description='The information about the progress of subtasks.'),
      totalProgress?: int32(name='totalProgress', description='The overall progress of the current task.', example='100'),
    }
  ](name='result', description='The progress of the task that is running on the instance.'),
}

model ListInstanceTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListInstanceTaskResponseBody(name='body'),
}

/**
 * @summary Queries all asynchronous tasks of a specified instance by using the instance ID.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListInstanceTaskResponse
 */
async function listInstanceTaskWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListInstanceTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListInstanceTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries all asynchronous tasks of a specified instance by using the instance ID.
 *
 * @return ListInstanceTaskResponse
 */
async function listInstanceTask(instanceId: string): ListInstanceTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listInstanceTaskWithOptions(instanceId, headers, runtime);
}

model ListItemsRequest {
  page?: int32(name='page', example='1'),
  size?: int32(name='size', example='10'),
  strategyUsed?: boolean(name='strategyUsed'),
  withInvalidDetail?: boolean(name='withInvalidDetail'),
}

model ListItemsResponseBody = {
  requestId?: string(name='requestId', example='6839AE7C-A984-48C1-AC17-331BAC6D97BC'),
  result?: {
    detail?: [ 
      {
        author?: string(name='author', example='abc'),
        brandId?: string(name='brandId', example='1'),
        categoryPath?: string(name='categoryPath', example='1_2'),
        channel?: string(name='channel', example='news'),
        duration?: string(name='duration', example='30'),
        expireTime?: string(name='expireTime', example='1647998107012'),
        itemId?: string(name='itemId', example='123'),
        itemType?: string(name='itemType', example='item'),
        pubTime?: string(name='pubTime', example='1647998107012'),
        shopId?: string(name='shopId', example='1'),
        status?: string(name='status', example='1'),
        title?: string(name='title', example='test'),
      }
    ](name='detail'),
    total?: {
      instanceRecommendItem?: long(name='instanceRecommendItem', example='200'),
      queryCount?: long(name='queryCount', example='3000'),
      sceneRecommendItem?: long(name='sceneRecommendItem', example='200'),
      sceneWeightItem?: long(name='sceneWeightItem', example='10'),
      totalCount?: long(name='totalCount', example='5000'),
      weightItem?: long(name='weightItem', example='10'),
    }(name='total'),
  }(name='result'),
}

model ListItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListItemsResponseBody(name='body'),
}

/**
 * @param request ListItemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListItemsResponse
 */
async function listItemsWithOptions(instanceId: string, request: ListItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.strategyUsed)) {
    query['strategyUsed'] = request.strategyUsed;
  }
  if (!Util.isUnset(request.withInvalidDetail)) {
    query['withInvalidDetail'] = request.withInvalidDetail;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListItems',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/items/actions/list`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListItemsRequest
 * @return ListItemsResponse
 */
async function listItems(instanceId: string, request: ListItemsRequest): ListItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listItemsWithOptions(instanceId, request, headers, runtime);
}

model ListLogsRequest {
  endTime?: int32(name='endTime', description='This parameter is required.'),
  page?: int32(name='page', example='1'),
  queryParams?: string(name='queryParams'),
  size?: int32(name='size'),
  startTime?: int32(name='startTime', description='This parameter is required.', example='1586673466'),
}

model ListLogsResponseBody = {
  code?: string(name='code'),
  headers?: {
    xTotalCount?: int32(name='X-Total-Count'),
  }(name='headers'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [  map[string]any ](name='result'),
}

model ListLogsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListLogsResponseBody(name='body'),
}

/**
 * @param request ListLogsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListLogsResponse
 */
async function listLogsWithOptions(instanceId: string, request: ListLogsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListLogsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.queryParams)) {
    query['queryParams'] = request.queryParams;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLogs',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/logs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListLogsRequest
 * @return ListLogsResponse
 */
async function listLogs(instanceId: string, request: ListLogsRequest): ListLogsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listLogsWithOptions(instanceId, request, headers, runtime);
}

model ListMixCategoriesResponseBody = {
  code?: string(name='code', description='The HTTP status code.', example='200'),
  message?: string(name='message', description='The error message.', example='Success'),
  requestId?: string(name='requestId', description='The request ID.', example='ED093A1D-1C56-57A2-B078-3C518F632F03'),
  result?: [ 
    {
      categories?: [ long ](name='categories', description='The content type.'),
    }
  ](name='result', description='The returned result.'),
}

model ListMixCategoriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListMixCategoriesResponseBody(name='body'),
}

/**
 * @summary Queries the content types supported in the diversity rule configurations of an instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListMixCategoriesResponse
 */
async function listMixCategoriesWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListMixCategoriesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListMixCategories',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/configurations/mixCategories`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the content types supported in the diversity rule configurations of an instance.
 *
 * @return ListMixCategoriesResponse
 */
async function listMixCategories(): ListMixCategoriesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listMixCategoriesWithOptions(headers, runtime);
}

model ListOfflineStoragesResponseBody = {
  requestId?: bytes(name='requestId', description='Id of the request', example='6839AE7C-A984-48C1-AC17-331BAC6D97BC'),
  result?: [ 
    {
      meta?: map[string]any(name='meta'),
      tableName?: bytes(name='tableName', example='item'),
    }
  ](name='result'),
}

model ListOfflineStoragesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListOfflineStoragesResponseBody(name='body'),
}

/**
 * @summary 获取离线存储列表
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListOfflineStoragesResponse
 */
async function listOfflineStoragesWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListOfflineStoragesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListOfflineStorages',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/%5BinstanceId%5D/offlineStorages`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取离线存储列表
 *
 * @return ListOfflineStoragesResponse
 */
async function listOfflineStorages(instanceId: string): ListOfflineStoragesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listOfflineStoragesWithOptions(instanceId, headers, runtime);
}

model ListRankingModelTemplatesRequest {
  page?: long(name='page', description='The number of the page to return.', example='1'),
  size?: long(name='size', description='The number of entries to return on each page.', example='1'),
}

model ListRankingModelTemplatesResponseBody = {
  requestId?: string(name='requestId'),
  result?: [
    RankingModelTemplate
  ](name='result'),
}

model ListRankingModelTemplatesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRankingModelTemplatesResponseBody(name='body'),
}

/**
 * @summary Queries the templates of a ranking model. The returned templates are sorted in reverse chronological order based on the time when the templates were created.
 *
 * @param request ListRankingModelTemplatesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRankingModelTemplatesResponse
 */
async function listRankingModelTemplatesWithOptions(instanceId: string, request: ListRankingModelTemplatesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRankingModelTemplatesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRankingModelTemplates',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-templates`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the templates of a ranking model. The returned templates are sorted in reverse chronological order based on the time when the templates were created.
 *
 * @param request ListRankingModelTemplatesRequest
 * @return ListRankingModelTemplatesResponse
 */
async function listRankingModelTemplates(instanceId: string, request: ListRankingModelTemplatesRequest): ListRankingModelTemplatesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRankingModelTemplatesWithOptions(instanceId, request, headers, runtime);
}

model ListRankingModelVersionsRequest {
  page?: long(name='page', description='The number of the page to return.', example='1'),
  size?: long(name='size', description='The number of entries to return on each page.', example='10'),
  status?: string(name='status', description='The state of the version. Valid values: DRAFT: The version is in the draft state. EFFECTIVE: The version is effective. PUBLISHING: The version is being published. INEFFECTIVE: The version has expired. FAILED: The version has not taken effect.', example='TRAINING'),
  templateId?: string(name='templateId', description='The ranking model ID.

This parameter is required.', example='a-a-a'),
}

model ListRankingModelVersionsResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: [
    RankingModelVersion
  ](name='result', description='The returned result.'),
}

model ListRankingModelVersionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRankingModelVersionsResponseBody(name='body'),
}

/**
 * @summary Queries a list of versions for a ranking model.
 *
 * @param request ListRankingModelVersionsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRankingModelVersionsResponse
 */
async function listRankingModelVersionsWithOptions(instanceId: string, request: ListRankingModelVersionsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRankingModelVersionsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }
  if (!Util.isUnset(request.templateId)) {
    query['templateId'] = request.templateId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRankingModelVersions',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-versions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a list of versions for a ranking model.
 *
 * @param request ListRankingModelVersionsRequest
 * @return ListRankingModelVersionsResponse
 */
async function listRankingModelVersions(instanceId: string, request: ListRankingModelVersionsRequest): ListRankingModelVersionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRankingModelVersionsWithOptions(instanceId, request, headers, runtime);
}

model ListRankingModelsRequest {
  page?: int32(name='page', example='1'),
  rankingModelId?: string(name='rankingModelId', example='xxx'),
  size?: int32(name='size'),
}

model ListRankingModelsResponseBody = {
  code?: string(name='code', example='200'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='2D898E45-B97A-4245-B590-6D0AFEAF626B'),
  result?: [ 
    {
      gmtCreate?: string(name='gmtCreate'),
      gmtModified?: string(name='gmtModified', example='2020-11-11T09:47:43.000Z'),
      meta?: map[string]any(name='meta'),
      rankingModelId?: string(name='rankingModelId', example='123'),
    }
  ](name='result'),
}

model ListRankingModelsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRankingModelsResponseBody(name='body'),
}

/**
 * @param request ListRankingModelsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRankingModelsResponse
 */
async function listRankingModelsWithOptions(instanceId: string, request: ListRankingModelsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRankingModelsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.rankingModelId)) {
    query['rankingModelId'] = request.rankingModelId;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRankingModels',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-models`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListRankingModelsRequest
 * @return ListRankingModelsResponse
 */
async function listRankingModels(instanceId: string, request: ListRankingModelsRequest): ListRankingModelsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRankingModelsWithOptions(instanceId, request, headers, runtime);
}

model ListRankingSystemHistoriesRequest {
  operateType?: string(name='operateType', description='The number of the page to return.', example='CONF_CHANGE'),
  page?: long(name='page', description='The number of entries to return on each page.', example='1'),
  size?: long(name='size', description='The schema of the response parameters.', example='10'),
}

model ListRankingSystemHistoriesResponseBody = {
  requestId?: string(name='requestId', description='The returned result.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: [
    RankingSystemHistory
  ](name='result', description='The response body.'),
}

model ListRankingSystemHistoriesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRankingSystemHistoriesResponseBody(name='body'),
}

/**
 * @summary The ID of the instance.
 *
 * @param request ListRankingSystemHistoriesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRankingSystemHistoriesResponse
 */
async function listRankingSystemHistoriesWithOptions(instanceId: string, name: string, request: ListRankingSystemHistoriesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRankingSystemHistoriesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.operateType)) {
    query['operateType'] = request.operateType;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRankingSystemHistories',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}/histories`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the instance.
 *
 * @param request ListRankingSystemHistoriesRequest
 * @return ListRankingSystemHistoriesResponse
 */
async function listRankingSystemHistories(instanceId: string, name: string, request: ListRankingSystemHistoriesRequest): ListRankingSystemHistoriesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRankingSystemHistoriesWithOptions(instanceId, name, request, headers, runtime);
}

model ListRankingSystemsRequest {
  deployStatus?: string(name='deployStatus', description='The name of the ranking service.', example='NOT_DEPLOYED'),
  name?: string(name='name', description='The ID of the instance.', example='service-a'),
  page?: long(name='page', description='The state of the deployment. Valid values: NOT_DEPLOYED: The ranking service is not deployed. DEPLOY_SUCCESS: The ranking service is deployed.', example='1'),
  size?: long(name='size', description='The number of the page to return.', example='10'),
}

model ListRankingSystemsResponseBody = {
  requestId?: string(name='requestId', description='The schema of the response parameters.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: [
    RankingSystem
  ](name='result', description='The ID of the request.'),
}

model ListRankingSystemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRankingSystemsResponseBody(name='body'),
}

/**
 * @summary 获取排序服务列表
 *
 * @param request ListRankingSystemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRankingSystemsResponse
 */
async function listRankingSystemsWithOptions(instanceId: string, request: ListRankingSystemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRankingSystemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.deployStatus)) {
    query['deployStatus'] = request.deployStatus;
  }
  if (!Util.isUnset(request.name)) {
    query['name'] = request.name;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRankingSystems',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取排序服务列表
 *
 * @param request ListRankingSystemsRequest
 * @return ListRankingSystemsResponse
 */
async function listRankingSystems(instanceId: string, request: ListRankingSystemsRequest): ListRankingSystemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRankingSystemsWithOptions(instanceId, request, headers, runtime);
}

model ListRuleConditionsResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      selectType?: string(name='selectType', description='The type of the filtering condition for the item selection rule.', example='QUERY_ITEM_TYPE'),
      selectValue?: string(name='selectValue', description='The specific value of the filtering condition for the item selection rule.', example='xxx'),
      selectionOperation?: string(name='selectionOperation', description='The operation on the filtering condition for the item selection rule.', example='QUERY_VALUE_IN'),
    }
  ](name='result', description='The returned results.'),
}

model ListRuleConditionsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRuleConditionsResponseBody(name='body'),
}

/**
 * @summary Queries item selection rules of an instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRuleConditionsResponse
 */
async function listRuleConditionsWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListRuleConditionsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListRuleConditions',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rule-conditions`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries item selection rules of an instance.
 *
 * @return ListRuleConditionsResponse
 */
async function listRuleConditions(instanceId: string): ListRuleConditionsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRuleConditionsWithOptions(instanceId, headers, runtime);
}

model ListRuleTasksRequest {
  sceneId?: string(name='sceneId', description='The completion rate of the task.

This parameter is required.', example='testid'),
}

model ListRuleTasksResponseBody = {
  code?: string(name='code', description='Queries the status of a rule-specific task.', example='InternalServerError'),
  message?: string(name='message', description='The ID of the scene.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the instance.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    finishRate?: int32(name='finishRate', description='The ID of the instance.', example='50'),
    finishTime?: int32(name='finishTime', description='The ID of the request.', example='1588240081'),
  }(name='result', description='The error message.'),
}

model ListRuleTasksResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRuleTasksResponseBody(name='body'),
}

/**
 * @summary The returned results.
 *
 * @param request ListRuleTasksRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRuleTasksResponse
 */
async function listRuleTasksWithOptions(instanceId: string, request: ListRuleTasksRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRuleTasksResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRuleTasks',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rule-tasks`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The returned results.
 *
 * @param request ListRuleTasksRequest
 * @return ListRuleTasksResponse
 */
async function listRuleTasks(instanceId: string, request: ListRuleTasksRequest): ListRuleTasksResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRuleTasksWithOptions(instanceId, request, headers, runtime);
}

model ListRulesRequest {
  endTime?: long(name='endTime', example='1567584765'),
  page?: int32(name='page', example='1'),
  ruleType?: string(name='ruleType', description='This parameter is required.', example='selection'),
  sceneId?: string(name='sceneId', description='This parameter is required.', example='test'),
  size?: int32(name='size', example='10'),
  startTime?: long(name='startTime', example='1567584765'),
  status?: string(name='status', example='EFFECTIVE'),
}

model ListRulesResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: [ 
    {
      gmtCreate?: string(name='gmtCreate', example='2020-04-27T06:38:28.000Z'),
      gmtModified?: string(name='gmtModified', example='2020-04-27T06:38:28.000Z'),
      ruleId?: string(name='ruleId', example='98493A14-D619-4E88-9F8D-108939817F9F'),
      status?: string(name='status', example='true'),
    }
  ](name='result'),
}

model ListRulesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListRulesResponseBody(name='body'),
}

/**
 * @param request ListRulesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListRulesResponse
 */
async function listRulesWithOptions(instanceId: string, request: ListRulesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListRulesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.ruleType)) {
    query['ruleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListRules',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rules`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request ListRulesRequest
 * @return ListRulesResponse
 */
async function listRules(instanceId: string, request: ListRulesRequest): ListRulesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listRulesWithOptions(instanceId, request, headers, runtime);
}

model ListSampleFormatConfigsResponseBody = {
  requestId?: string(name='requestId', example='EDF43C1F-99E4-431F-A7C0-8B260A5A792E'),
  result?: map[string]any(name='result', example='xxx'),
}

model ListSampleFormatConfigsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSampleFormatConfigsResponseBody(name='body'),
}

/**
 * @summary 获取样本格式化配置列表
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSampleFormatConfigsResponse
 */
async function listSampleFormatConfigsWithOptions(instanceId: string, sampleId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListSampleFormatConfigsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListSampleFormatConfigs',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}/format-configs`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取样本格式化配置列表
 *
 * @return ListSampleFormatConfigsResponse
 */
async function listSampleFormatConfigs(instanceId: string, sampleId: string): ListSampleFormatConfigsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSampleFormatConfigsWithOptions(instanceId, sampleId, headers, runtime);
}

model ListSamplesRequest {
  page?: long(name='page', example='1'),
  sampleId?: string(name='sampleId', example='Sample1'),
  size?: long(name='size', example='10'),
}

model ListSamplesResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: [
    Sample
  ](name='result', example='result'),
}

model ListSamplesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSamplesResponseBody(name='body'),
}

/**
 * @summary 获取样本列表
 *
 * @param request ListSamplesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSamplesResponse
 */
async function listSamplesWithOptions(instanceId: string, request: ListSamplesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSamplesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.sampleId)) {
    query['sampleId'] = request.sampleId;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSamples',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 获取样本列表
 *
 * @param request ListSamplesRequest
 * @return ListSamplesResponse
 */
async function listSamples(instanceId: string, request: ListSamplesRequest): ListSamplesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSamplesWithOptions(instanceId, request, headers, runtime);
}

model ListSceneItemsRequest {
  operationRuleId?: string(name='operationRuleId'),
  page?: int32(name='page'),
  previewType?: string(name='previewType'),
  queryCount?: int32(name='queryCount'),
  selectionRuleId?: string(name='selectionRuleId'),
  size?: int32(name='size'),
}

model ListSceneItemsResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: {
    detail?: [ 
      {
        author?: string(name='author'),
        brandId?: string(name='brandId'),
        categoryPath?: string(name='categoryPath'),
        channel?: string(name='channel'),
        duration?: string(name='duration'),
        expireTime?: string(name='expireTime'),
        itemId?: string(name='itemId'),
        itemType?: string(name='itemType'),
        pubTime?: string(name='pubTime'),
        shopId?: string(name='shopId'),
        status?: string(name='status'),
        title?: string(name='title'),
      }
    ](name='detail'),
    total?: {
      instanceRecommendItem?: long(name='instanceRecommendItem'),
      sceneRecommendItem?: long(name='sceneRecommendItem'),
      sceneWeightItem?: long(name='sceneWeightItem'),
      totalCount?: long(name='totalCount'),
      weightItem?: long(name='weightItem'),
    }(name='total'),
  }(name='result'),
}

model ListSceneItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSceneItemsResponseBody(name='body'),
}

/**
 * @summary Queries preview results.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param request ListSceneItemsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSceneItemsResponse
 */
async function listSceneItemsWithOptions(instanceId: string, sceneId: string, request: ListSceneItemsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListSceneItemsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.operationRuleId)) {
    query['operationRuleId'] = request.operationRuleId;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.previewType)) {
    query['previewType'] = request.previewType;
  }
  if (!Util.isUnset(request.queryCount)) {
    query['queryCount'] = request.queryCount;
  }
  if (!Util.isUnset(request.selectionRuleId)) {
    query['selectionRuleId'] = request.selectionRuleId;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListSceneItems',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/items`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries preview results.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param request ListSceneItemsRequest
 * @return ListSceneItemsResponse
 */
async function listSceneItems(instanceId: string, sceneId: string, request: ListSceneItemsRequest): ListSceneItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSceneItemsWithOptions(instanceId, sceneId, request, headers, runtime);
}

model ListSceneParametersResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: {
    sceneId?: [ string ](name='sceneId'),
    traceId?: [ string ](name='traceId'),
  }(name='result'),
}

model ListSceneParametersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListSceneParametersResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListSceneParametersResponse
 */
async function listSceneParametersWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListSceneParametersResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListSceneParameters',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dashboard/scene-parameters`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ListSceneParametersResponse
 */
async function listSceneParameters(instanceId: string): ListSceneParametersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listSceneParametersWithOptions(instanceId, headers, runtime);
}

model ListScenesRequest {
  page?: int32(name='page', description='Specifies whether the item can be recommended.', example='1'),
  sceneId?: string(name='sceneId', description='The ID of the instance.', example='test'),
  size?: int32(name='size', description='The ID of the scene.', example='10'),
  status?: string(name='status'),
}

model ListScenesResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: [ 
    {
      gmtCreate?: string(name='gmtCreate'),
      gmtModified?: string(name='gmtModified'),
      sceneId?: string(name='sceneId'),
      status?: string(name='status'),
    }
  ](name='result'),
}

model ListScenesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListScenesResponseBody(name='body'),
}

/**
 * @summary Queries scenes of a specified instance.
 *
 * @description We recommend that you do not call an API operation to manage scenes. Go to the Scenario Building page in the AIRec console to manage scenes.
 *
 * @param request ListScenesRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListScenesResponse
 */
async function listScenesWithOptions(instanceId: string, request: ListScenesRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ListScenesResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.status)) {
    query['status'] = request.status;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListScenes',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries scenes of a specified instance.
 *
 * @description We recommend that you do not call an API operation to manage scenes. Go to the Scenario Building page in the AIRec console to manage scenes.
 *
 * @param request ListScenesRequest
 * @return ListScenesResponse
 */
async function listScenes(instanceId: string, request: ListScenesRequest): ListScenesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listScenesWithOptions(instanceId, request, headers, runtime);
}

model ListUmengAppkeysResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: [ 
    {
      appkey?: string(name='appkey', example='5ddcf39f57729e708b00000e'),
      name?: string(name='name', example='xxx'),
      platform?: string(name='platform', example='ios'),
    }
  ](name='result'),
}

model ListUmengAppkeysResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListUmengAppkeysResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListUmengAppkeysResponse
 */
async function listUmengAppkeysWithOptions(headers: map[string]string, runtime: Util.RuntimeOptions): ListUmengAppkeysResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListUmengAppkeys',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/umeng/appkeys`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ListUmengAppkeysResponse
 */
async function listUmengAppkeys(): ListUmengAppkeysResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listUmengAppkeysWithOptions(headers, runtime);
}

model ListUserClustersResponseBody = {
  headers?: {
    xTotalCount?: int32(name='X-Total-Count', example='1'),
  }(name='headers'),
  requestId?: string(name='requestId', example='1E2CBBA8-C623-4FEE-BC84-9672E460CA39'),
  result?: [ 
    {
      gmtCreate?: string(name='gmtCreate', example='2018-12-07T02:24:26.000Z'),
      gmtModified?: string(name='gmtModified', example='2018-12-07T02:24:26.000Z'),
      meta?: {
        description?: string(name='description', example='tst'),
        metaType?: string(name='metaType', example='UserCluster'),
      }(name='meta', description='meta'),
      name?: string(name='name', example='mycluster-for-airec'),
      status?: string(name='status', example='1'),
    }
  ](name='result'),
}

model ListUserClustersResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ListUserClustersResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ListUserClustersResponse
 */
async function listUserClustersWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ListUserClustersResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ListUserClusters',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/user-clusters`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ListUserClustersResponse
 */
async function listUserClusters(instanceId: string): ListUserClustersResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return listUserClustersWithOptions(instanceId, headers, runtime);
}

model ModifyDataSourceResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The time when the data source was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the data source was last modified. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2018-12-07T02:24:26.000Z'),
    meta?: {
      accessKeyId?: string(name='accessKeyId', description='The AccessKey ID of the Alibaba Cloud account.', example='xxx'),
      bucketName?: string(name='bucketName', description='The name of the Object Storage Service (OSS) bucket.', example='airec'),
      partition?: string(name='partition', description='The partition in the MaxCompute table.', example='ds=20181122'),
      path?: string(name='path', description='The path of the OSS data source.', example='oss://xxx.xxx'),
      projectName?: string(name='projectName', description='The name of the MaxCompute project.', example='openrec_gray'),
      tableName?: string(name='tableName', description='The name of the MaxCompute table.', example='test_maxcompute'),
      timestamp?: long(name='timestamp', description='The timestamp. The value must be accurate to the millisecond.', example='1544112000000'),
      type?: string(name='type', description='The type of the data source. Only MaxCompute is supported.', example='ODPS'),
    }(name='meta', description='The parameters of the data source.'),
    tableName?: string(name='tableName', description='The name of the table.', example='behavior'),
  }(name='result', description='The details about the data source.'),
}

model ModifyDataSourceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyDataSourceResponseBody(name='body'),
}

/**
 * @summary Modifies the information of a single data source in a table of a specified instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyDataSourceResponse
 */
async function modifyDataSourceWithOptions(instanceId: string, tableName: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyDataSourceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyDataSource',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSources/${OpenApiUtil.getEncodeParam(tableName)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the information of a single data source in a table of a specified instance.
 *
 * @return ModifyDataSourceResponse
 */
async function modifyDataSource(instanceId: string, tableName: string): ModifyDataSourceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyDataSourceWithOptions(instanceId, tableName, headers, runtime);
}

model ModifyFeatureTableResponseBody = {
  requestId?: string(name='requestId', description='Modifies a feature table.', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: FeatureTable(name='result'),
}

model ModifyFeatureTableResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyFeatureTableResponseBody(name='body'),
}

/**
 * @summary 修改特征表，只支表级别持特征列表的全量修改
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyFeatureTableResponse
 */
async function modifyFeatureTableWithOptions(instanceId: string, type: string, featureTableId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyFeatureTableResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyFeatureTable',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/feature-tables/${OpenApiUtil.getEncodeParam(type)}/${OpenApiUtil.getEncodeParam(featureTableId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改特征表，只支表级别持特征列表的全量修改
 *
 * @return ModifyFeatureTableResponse
 */
async function modifyFeatureTable(instanceId: string, type: string, featureTableId: string): ModifyFeatureTableResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyFeatureTableWithOptions(instanceId, type, featureTableId, headers, runtime);
}

model ModifyFilteringAlgorithmMetaResponseBody = {
  requestId?: string(name='requestId', example='7585C2B2-0D61-4C96-AC5D-B960BFEDD4A3'),
  result?: {
    algorithmId?: string(name='algorithmId', example='abc'),
    gmtCreate?: string(name='gmtCreate', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', example='2018-12-07T02:24:26.000Z'),
    meta?: {
      algorithmName?: string(name='algorithmName', example='test'),
      category?: string(name='category', example='1_2'),
      clusterId?: string(name='clusterId', example='244'),
      cron?: string(name='cron', example='* * 24 7 0'),
      cronEnabled?: boolean(name='cronEnabled'),
      description?: string(name='description', example='test'),
      extInfo?: {
        itemSeparator?: string(name='itemSeparator', example=','),
        kvSeparator?: string(name='kvSeparator', example=':'),
      }(name='extInfo'),
      metaType?: string(name='metaType', example='metaType'),
      projectName?: string(name='projectName', example='test'),
      tableName?: string(name='tableName', example='test_table'),
      taskId?: string(name='taskId', example='taskId'),
      threshold?: {
        indexLossThreshold?: int32(name='indexLossThreshold', example='1'),
        indexSizeThreshold?: int32(name='indexSizeThreshold', example='1'),
        sourceDataRecordThreshold?: int32(name='sourceDataRecordThreshold', example='1'),
        sourceDataSizeThreshold?: int32(name='sourceDataSizeThreshold', example='1'),
      }(name='threshold'),
      type?: string(name='type', example='ODPS'),
    }(name='meta'),
    status?: string(name='status', example='Running'),
  }(name='result'),
}

model ModifyFilteringAlgorithmMetaResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyFilteringAlgorithmMetaResponseBody(name='body'),
}

/**
 * @summary The name of the project.
 *
 * @description The name of the filtering algorithm.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyFilteringAlgorithmMetaResponse
 */
async function modifyFilteringAlgorithmMetaWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyFilteringAlgorithmMetaResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyFilteringAlgorithmMeta',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/meta`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The name of the project.
 *
 * @description The name of the filtering algorithm.
 *
 * @return ModifyFilteringAlgorithmMetaResponse
 */
async function modifyFilteringAlgorithmMeta(instanceId: string, algorithmId: string): ModifyFilteringAlgorithmMetaResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyFilteringAlgorithmMetaWithOptions(instanceId, algorithmId, headers, runtime);
}

model ModifyFlowControlTaskRequest {
  taskName?: string(name='TaskName', description='The name of the task.', example='testname'),
  description?: string(name='description', description='The description of the task.', example='Description'),
  endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.', example='1639519200'),
  metaType?: string(name='metaType', description='The type of the metadata.', example='FlowControlTask'),
  sceneIds?: string(name='sceneIds', description='The ID of the scene.', example='all,sy101'),
  selectionParams?: [ 
    {
      selectType?: string(name='selectType', description='The type of the filtering condition for the item selection rule.', example='invalidItem'),
      selectValue?: string(name='selectValue', description='The number of filtering conditions for the item selection rule.', example='20'),
      selectionOperation?: string(name='selectionOperation', description='The operation on the filtering condition for the item selection rule.', example='OPERATOR_HIGHER'),
    }
  ](name='selectionParams', description='The parameters specified for the item selection rule.'),
  startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.', example='1638460800'),
  target?: {
    type?: string(name='type', description='The type of the exposure.', example='EXPOSE_PERCENT'),
    value?: long(name='value', description='The number of exposures.', example='50'),
  }(name='target', description='The settings for item exposure.'),
}

model ModifyFlowControlTaskResponseBody = {
  requestId?: string(name='requestId', description='The ID of the request. The value is unique for each request. This facilitates troubleshooting.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    taskId?: string(name='TaskId', description='The ID of the task.', example='1661506482'),
    gmtCreate?: string(name='gmtCreate', description='The time when the task was created.', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the task was modified.', example='2020-11-11T09:47:43.000Z'),
    meta?: {
      description?: string(name='description', description='The description of the task.', example='tst'),
      endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.', example='1656518399'),
      metaType?: string(name='metaType', description='The type of the metadata.', example='FlowControlTask'),
      sceneIds?: string(name='sceneIds', description='The IDs of scenes.', example='1,2,3'),
      selectionParams?: [ 
        {
          selectType?: string(name='selectType', description='The type of the filtering condition for the item selection rule.', example='QUERY_PUB_TIME'),
          selectValue?: string(name='selectValue', description='The number of filtering conditions for the item selection rule.', example='10000'),
          selectionOperation?: string(name='selectionOperation', description='The operation on the filtering condition for the item selection rule.', example='OPERATOR_HIGHER'),
        }
      ](name='selectionParams', description='The parameters specified for the item selection rule.'),
      startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.', example='1640739600'),
      target?: {
        type?: string(name='type', description='The type of the exposure.', example='EXPOSE_PERCENT'),
        value?: long(name='value', description='The number of exposures.', example='20'),
      }(name='target', description='The settings for item exposure.'),
      taskName?: string(name='taskName', description='The name of the task.', example='Active user test'),
    }(name='meta', description='The metadata.'),
    status?: string(name='status', description='The state of the task.', example='DRAFT'),
  }(name='result', description='The returned result.'),
}

model ModifyFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary Modifies a throttling task.
 *
 * @param request ModifyFlowControlTaskRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyFlowControlTaskResponse
 */
async function modifyFlowControlTaskWithOptions(instanceId: string, taskId: string, request: ModifyFlowControlTaskRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyFlowControlTaskResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.taskName)) {
    body['TaskName'] = request.taskName;
  }
  if (!Util.isUnset(request.description)) {
    body['description'] = request.description;
  }
  if (!Util.isUnset(request.endTime)) {
    body['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.metaType)) {
    body['metaType'] = request.metaType;
  }
  if (!Util.isUnset(request.sceneIds)) {
    body['sceneIds'] = request.sceneIds;
  }
  if (!Util.isUnset(request.selectionParams)) {
    body['selectionParams'] = request.selectionParams;
  }
  if (!Util.isUnset(request.startTime)) {
    body['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.target)) {
    body['target'] = request.target;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a throttling task.
 *
 * @param request ModifyFlowControlTaskRequest
 * @return ModifyFlowControlTaskResponse
 */
async function modifyFlowControlTask(instanceId: string, taskId: string, request: ModifyFlowControlTaskRequest): ModifyFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyFlowControlTaskWithOptions(instanceId, taskId, request, headers, runtime);
}

model ModifyInstanceResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    chargeType?: string(name='chargeType', description='The billing method. Valid values: PrePaid and PostPaid. Only the PrePaid billing method is supported.', example='PrePaid'),
    commodityCode?: string(name='commodityCode', description='The commodity code of the recommended item.', example='airecpre'),
    dataSetVersion?: string(name='dataSetVersion', description='The version of the dataset that provides online services.', example='20181206170353'),
    expiredTime?: string(name='expiredTime', description='The time when the instance expires. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format.The time is displayed in UTC.', example='2019-01-06T16:00:00.000Z'),
    gmtCreate?: string(name='gmtCreate', description='The time when the instance was created. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2018-12-06T06:14:01.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the instance was last modified. The time follows the ISO 8601 standard in the yyyy-MM-ddThh:mm:ssZ format. The time is displayed in UTC.', example='2018-12-06T11:17:49.000Z'),
    industry?: string(name='industry', description='The type of the industry. Valid values: content, item, news, video, and sns.', example='news'),
    instanceId?: string(name='instanceId', description='The instance ID.', example='airec-cn-o400whm78004'),
    lockMode?: string(name='lockMode', description='The lock mode of the instance. Valid values: Unlock, ManualLock, and LockByExpiration.', example='Unlock'),
    name?: string(name='name', description='The name of the instance.', example='Test instance'),
    regionId?: string(name='regionId', description='The region where the instance resides.', example='cn-beijing'),
    status?: string(name='status', description='The state of the instance. Valid values: Initializing, Ready, and Running.', example='Running'),
    type?: string(name='type', description='The type of the instance. Only the Standard edition is supported.', example='Standard'),
  }(name='result', description='The returned results.'),
}

model ModifyInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyInstanceResponseBody(name='body'),
}

/**
 * @summary Modifies the configurations of a specified instance.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyInstanceResponse
 */
async function modifyInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the configurations of a specified instance.
 *
 * @return ModifyInstanceResponse
 */
async function modifyInstance(instanceId: string): ModifyInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyInstanceWithOptions(instanceId, headers, runtime);
}

model ModifyItemsResponseBody = {
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: boolean(name='result', example='true'),
}

model ModifyItemsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyItemsResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyItemsResponse
 */
async function modifyItemsWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyItemsResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyItems',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/items`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ModifyItemsResponse
 */
async function modifyItems(instanceId: string): ModifyItemsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyItemsWithOptions(instanceId, headers, runtime);
}

model ModifyOfflineStoragesResponseBody = {
  requestId?: bytes(name='requestId', description='The request ID.', example='7F176EE8-51DA-4B4D-8FFE-04448CD7A171'),
  result?: boolean(name='result', description='The returned result.', example='true'),
}

model ModifyOfflineStoragesResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyOfflineStoragesResponseBody(name='body'),
}

/**
 * @summary Modifies the offline storage configurations of an instance. You need to modify three tables at the same time.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyOfflineStoragesResponse
 */
async function modifyOfflineStoragesWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyOfflineStoragesResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyOfflineStorages',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/%5BinstanceId%5D/offlineStorages`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the offline storage configurations of an instance. You need to modify three tables at the same time.
 *
 * @return ModifyOfflineStoragesResponse
 */
async function modifyOfflineStorages(instanceId: string): ModifyOfflineStoragesResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyOfflineStoragesWithOptions(instanceId, headers, runtime);
}

model ModifyRankingModelResponseBody = {
  code?: string(name='code', example='1'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The error message.', example='2020-11-11T09:47:43.000Z'),
    gmtModified?: string(name='gmtModified', description='The ID of the request.', example='2020-11-11T09:47:43.000Z'),
    meta?: map[string]any(name='meta', description='__null__', example='{}'),
    rankingModelId?: string(name='rankingModelId', description='The error code.', example='test1234'),
  }(name='result', description='The data source of the filtering table. Only MaxCompute tables are supported.'),
}

model ModifyRankingModelResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyRankingModelResponseBody(name='body'),
}

/**
 * @summary The ID of the ranking model.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyRankingModelResponse
 */
async function modifyRankingModelWithOptions(instanceId: string, rankingModelId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyRankingModelResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyRankingModel',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-models/${OpenApiUtil.getEncodeParam(rankingModelId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The ID of the ranking model.
 *
 * @return ModifyRankingModelResponse
 */
async function modifyRankingModel(instanceId: string, rankingModelId: string): ModifyRankingModelResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyRankingModelWithOptions(instanceId, rankingModelId, headers, runtime);
}

model ModifyRankingModelTemplateRequest {
  body?: map[string]any(name='body', description='The request body.', example='{}'),
}

model ModifyRankingModelTemplateResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: RankingModelTemplate(name='result', description='The information about the ranking model.'),
}

model ModifyRankingModelTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyRankingModelTemplateResponseBody(name='body'),
}

/**
 * @summary Modifies a ranking model.
 *
 * @param request ModifyRankingModelTemplateRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyRankingModelTemplateResponse
 */
async function modifyRankingModelTemplateWithOptions(instanceId: string, templateId: string, request: ModifyRankingModelTemplateRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyRankingModelTemplateResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyRankingModelTemplate',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-templates/${OpenApiUtil.getEncodeParam(templateId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a ranking model.
 *
 * @param request ModifyRankingModelTemplateRequest
 * @return ModifyRankingModelTemplateResponse
 */
async function modifyRankingModelTemplate(instanceId: string, templateId: string, request: ModifyRankingModelTemplateRequest): ModifyRankingModelTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyRankingModelTemplateWithOptions(instanceId, templateId, request, headers, runtime);
}

model ModifyRankingSystemRequest {
  body?: map[string]any(name='body', description='The configurations that you want to modify.', example='{}'),
}

model ModifyRankingSystemResponseBody = {
  requestId?: string(name='requestId', description='The ID of the request.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: RankingSystem(name='result', description='The ranking service that was modified.'),
}

model ModifyRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyRankingSystemResponseBody(name='body'),
}

/**
 * @summary Modifies a ranking service.
 *
 * @param request ModifyRankingSystemRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyRankingSystemResponse
 */
async function modifyRankingSystemWithOptions(instanceId: string, name: string, request: ModifyRankingSystemRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyRankingSystemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifyRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a ranking service.
 *
 * @param request ModifyRankingSystemRequest
 * @return ModifyRankingSystemResponse
 */
async function modifyRankingSystem(instanceId: string, name: string, request: ModifyRankingSystemRequest): ModifyRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyRankingSystemWithOptions(instanceId, name, request, headers, runtime);
}

model ModifyRuleResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the request.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: string(name='gmtCreate', description='The time when the rule was created.', example='2020-04-27T06:38:28.000Z'),
    gmtModified?: string(name='gmtModified', description='The time when the rule was last modified.', example='2020-04-27T06:38:28.000Z'),
    ruleId?: string(name='ruleId', description='The ID of the rule.', example='98493A14-D619-4E88-9F8D-108939817F9F'),
    ruleMeta?: map[string]any(name='ruleMeta', description='The specific information about the rule.', example='xxx'),
    status?: string(name='status', description='Indicates whether the rule is enabled. Valid values: true and false.', example='true'),
  }(name='result', description='The returned result.'),
}

model ModifyRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifyRuleResponseBody(name='body'),
}

/**
 * @summary Modifies a rule.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifyRuleResponse
 */
async function modifyRuleWithOptions(instanceId: string, ruleId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifyRuleResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyRule',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rules/${OpenApiUtil.getEncodeParam(ruleId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies a rule.
 *
 * @return ModifyRuleResponse
 */
async function modifyRule(instanceId: string, ruleId: string): ModifyRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifyRuleWithOptions(instanceId, ruleId, headers, runtime);
}

model ModifySampleRequest {
  body?: map[string]any(name='body'),
}

model ModifySampleResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: Sample(name='result'),
}

model ModifySampleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifySampleResponseBody(name='body'),
}

/**
 * @summary 修改样本配置
 *
 * @param request ModifySampleRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifySampleResponse
 */
async function modifySampleWithOptions(instanceId: string, sampleId: string, request: ModifySampleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): ModifySampleResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'ModifySample',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 修改样本配置
 *
 * @param request ModifySampleRequest
 * @return ModifySampleResponse
 */
async function modifySample(instanceId: string, sampleId: string, request: ModifySampleRequest): ModifySampleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifySampleWithOptions(instanceId, sampleId, request, headers, runtime);
}

model ModifySceneResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId'),
  result?: {
    gmtCreate?: string(name='gmtCreate'),
    gmtModified?: string(name='gmtModified'),
    sceneId?: string(name='sceneId'),
    status?: string(name='status'),
  }(name='result'),
}

model ModifySceneResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ModifySceneResponseBody(name='body'),
}

/**
 * @summary Modifies the information about a scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ModifySceneResponse
 */
async function modifySceneWithOptions(instanceId: string, sceneId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ModifySceneResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ModifyScene',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the information about a scene.
 *
 * @description We recommend that you do not call an API operation to manage scenes. We recommend that you go to the Scenario Building page in the Artificial Intelligence Recommendation (AIRec) console to manage scenes.
 *
 * @return ModifySceneResponse
 */
async function modifyScene(instanceId: string, sceneId: string): ModifySceneResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return modifySceneWithOptions(instanceId, sceneId, headers, runtime);
}

model OfflineFilteringAlgorithmResponseBody = {
  requestId?: string(name='requestId', example='7585C2B2-0D61-4C96-AC5D-B960BFEDD4A3'),
  result?: {
    algorithmId?: string(name='algorithmId', example='abc'),
    gmtCreate?: string(name='gmtCreate', example='2018-12-07T02:24:26.000Z'),
    gmtModified?: string(name='gmtModified', example='2018-12-07T02:24:26.000Z'),
    meta?: {
      algorithmName?: string(name='algorithmName', example='test'),
      category?: string(name='category', example='1_2'),
      clusterId?: string(name='clusterId', example='244'),
      cron?: string(name='cron', example='* * 24 7 0'),
      cronEnabled?: boolean(name='cronEnabled'),
      description?: string(name='description', example='test'),
      extInfo?: {
        itemSeparator?: string(name='itemSeparator', example=','),
        kvSeparator?: string(name='kvSeparator', example=':'),
      }(name='extInfo'),
      metaType?: string(name='metaType', example='metaType'),
      projectName?: string(name='projectName', example='test'),
      tableName?: string(name='tableName', example='test_table'),
      taskId?: string(name='taskId', example='taskId'),
      threshold?: {
        indexLossThreshold?: int32(name='indexLossThreshold', example='1'),
        indexSizeThreshold?: int32(name='indexSizeThreshold', example='1'),
        sourceDataRecordThreshold?: int32(name='sourceDataRecordThreshold', example='1'),
        sourceDataSizeThreshold?: int32(name='sourceDataSizeThreshold', example='1'),
      }(name='threshold'),
      type?: string(name='type', example='ODPS'),
    }(name='meta'),
    status?: string(name='status', example='Init'),
  }(name='result'),
}

model OfflineFilteringAlgorithmResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: OfflineFilteringAlgorithmResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return OfflineFilteringAlgorithmResponse
 */
async function offlineFilteringAlgorithmWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): OfflineFilteringAlgorithmResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'OfflineFilteringAlgorithm',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/actions/offline`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return OfflineFilteringAlgorithmResponse
 */
async function offlineFilteringAlgorithm(instanceId: string, algorithmId: string): OfflineFilteringAlgorithmResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return offlineFilteringAlgorithmWithOptions(instanceId, algorithmId, headers, runtime);
}

model PublishFlowControlTaskResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: boolean(name='result', example='true'),
}

model PublishFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PublishFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary 发布流调任务接口
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PublishFlowControlTaskResponse
 */
async function publishFlowControlTaskWithOptions(instanceId: string, taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): PublishFlowControlTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'PublishFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/actions/publish`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 发布流调任务接口
 *
 * @return PublishFlowControlTaskResponse
 */
async function publishFlowControlTask(instanceId: string, taskId: string): PublishFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return publishFlowControlTaskWithOptions(instanceId, taskId, headers, runtime);
}

model PublishRuleRequest {
  ruleType?: string(name='ruleType', description='The type of the rule. Example: selection and operation.

This parameter is required.', example='selection'),
  sceneId?: string(name='sceneId', description='The scene ID.

This parameter is required.', example='test'),
}

model PublishRuleResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    ruleId?: string(name='ruleId', description='The rule ID.', example='98493A14-D619-4E88-9F8D-108939817F9F'),
  }(name='result', description='The returned result.'),
}

model PublishRuleResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PublishRuleResponseBody(name='body'),
}

/**
 * @summary Publishes a rule.
 *
 * @param request PublishRuleRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PublishRuleResponse
 */
async function publishRuleWithOptions(ruleId: string, instanceId: string, request: PublishRuleRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PublishRuleResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.ruleType)) {
    query['ruleType'] = request.ruleType;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'PublishRule',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/rules/${OpenApiUtil.getEncodeParam(ruleId)}/actions/publish`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Publishes a rule.
 *
 * @param request PublishRuleRequest
 * @return PublishRuleResponse
 */
async function publishRule(ruleId: string, instanceId: string, request: PublishRuleRequest): PublishRuleResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return publishRuleWithOptions(ruleId, instanceId, request, headers, runtime);
}

model PushColdStartDocumentRequest {
  body?: [ 
    {
      cmd?: string(name='cmd', example='add'),
      fields?: any(name='fields', example='userId'),
    }
  ](name='body'),
}

model PushColdStartDocumentResponseBody = {
  requestId?: string(name='requestId', example='7585C2B2-0D61-4C96-AC5D-B960BFEDD4A3'),
  result?: boolean(name='result', example='True'),
}

model PushColdStartDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PushColdStartDocumentResponseBody(name='body'),
}

/**
 * @summary 该接口用于向指定冷启动实例指定表推送文档
 *
 * @param request PushColdStartDocumentRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PushColdStartDocumentResponse
 */
async function pushColdStartDocumentWithOptions(instanceId: string, tableName: string, request: PushColdStartDocumentRequest, headers: map[string]string, runtime: Util.RuntimeOptions): PushColdStartDocumentResponse {
  Util.validateModel(request);
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = Util.toArray(request.body),
  };
  var params = new OpenApi.Params{
    action = 'PushColdStartDocument',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/cold-start/${OpenApiUtil.getEncodeParam(instanceId)}/tables/${OpenApiUtil.getEncodeParam(tableName)}/actions/bulk`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 该接口用于向指定冷启动实例指定表推送文档
 *
 * @param request PushColdStartDocumentRequest
 * @return PushColdStartDocumentResponse
 */
async function pushColdStartDocument(instanceId: string, tableName: string, request: PushColdStartDocumentRequest): PushColdStartDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return pushColdStartDocumentWithOptions(instanceId, tableName, request, headers, runtime);
}

model PushDocumentResponseBody = {
  code?: string(name='code', example='0'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: boolean(name='result', description='true/false', example='true'),
}

model PushDocumentResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PushDocumentResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PushDocumentResponse
 */
async function pushDocumentWithOptions(instanceId: string, tableName: string, headers: map[string]string, runtime: Util.RuntimeOptions): PushDocumentResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'PushDocument',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/tables/${OpenApiUtil.getEncodeParam(tableName)}/actions/bulk`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return PushDocumentResponse
 */
async function pushDocument(instanceId: string, tableName: string): PushDocumentResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return pushDocumentWithOptions(instanceId, tableName, headers, runtime);
}

model PushInterventionResponseBody = {
  code?: string(name='code', example='1'),
  message?: string(name='message', example='success'),
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: boolean(name='result', example='true'),
}

model PushInterventionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: PushInterventionResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return PushInterventionResponse
 */
async function pushInterventionWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): PushInterventionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'PushIntervention',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/actions/intervene`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return PushInterventionResponse
 */
async function pushIntervention(instanceId: string): PushInterventionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return pushInterventionWithOptions(instanceId, headers, runtime);
}

model QueryDataMessageRequest {
  bhvType?: string(name='bhvType', example='expose'),
  cmdType?: string(name='cmdType', example='update'),
  endTime?: long(name='endTime', description='This parameter is required.', example='1586673466'),
  imei?: string(name='imei'),
  itemId?: string(name='itemId', example='111'),
  itemType?: string(name='itemType', example='video'),
  messageSource?: string(name='messageSource', example='CONSOLE'),
  page?: int32(name='page', example='1'),
  sceneId?: string(name='sceneId', example='test'),
  size?: int32(name='size', example='20'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1586673466'),
  traceId?: string(name='traceId', example='Alibaba'),
  userId?: string(name='userId', example='222'),
  userType?: string(name='userType', example='app'),
}

model QueryDataMessageResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result', example='xxx'),
}

model QueryDataMessageResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryDataMessageResponseBody(name='body'),
}

/**
 * @param request QueryDataMessageRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryDataMessageResponse
 */
async function queryDataMessageWithOptions(instanceId: string, table: string, request: QueryDataMessageRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryDataMessageResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.bhvType)) {
    query['bhvType'] = request.bhvType;
  }
  if (!Util.isUnset(request.cmdType)) {
    query['cmdType'] = request.cmdType;
  }
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.imei)) {
    query['imei'] = request.imei;
  }
  if (!Util.isUnset(request.itemId)) {
    query['itemId'] = request.itemId;
  }
  if (!Util.isUnset(request.itemType)) {
    query['itemType'] = request.itemType;
  }
  if (!Util.isUnset(request.messageSource)) {
    query['messageSource'] = request.messageSource;
  }
  if (!Util.isUnset(request.page)) {
    query['page'] = request.page;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.size)) {
    query['size'] = request.size;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceId)) {
    query['traceId'] = request.traceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['userType'] = request.userType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDataMessage',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/tables/${OpenApiUtil.getEncodeParam(table)}/data-message`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryDataMessageRequest
 * @return QueryDataMessageResponse
 */
async function queryDataMessage(instanceId: string, table: string, request: QueryDataMessageRequest): QueryDataMessageResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryDataMessageWithOptions(instanceId, table, request, headers, runtime);
}

model QueryDataMessageStatisticsRequest {
  bhvType?: string(name='bhvType', description='The type of behaviors. Valid values: expose, click, like, comment, collect, stay, cart, buy, and evaluate.', example='expose'),
  cmdType?: string(name='cmdType', description='The type of the operation. Valid values: update, delete, and add.', example='update'),
  endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.

This parameter is required.', example='1586673466'),
  imei?: string(name='imei'),
  itemId?: string(name='itemId', description='The ID of the item. This parameter is required when the value of table is set to item.', example='111'),
  itemType?: string(name='itemType', description='The type of the item. This parameter is required when the value of table is set to item.', example='video'),
  messageSource?: string(name='messageSource', description='The source of the operation. Valid values:

CONSOLE and FEEDER.', example='FEEDER'),
  sceneId?: string(name='sceneId', description='The scene ID.', example='test'),
  startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.

This parameter is required.', example='1586673466'),
  traceId?: string(name='traceId', description='The event tracking ID.', example='Alibaba'),
  userId?: string(name='userId', description='The ID of the user. This parameter is required when the value of table is set to user.', example='222'),
  userType?: string(name='userType', description='The type of the user. This parameter is required when the value of table is set to user.', example='app'),
}

model QueryDataMessageStatisticsResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result', description='The returned result.', example='xxx'),
}

model QueryDataMessageStatisticsResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryDataMessageStatisticsResponseBody(name='body'),
}

/**
 * @summary Queries statistics on update messages in a data table of an instance.
 *
 * @description You can call this API operation to query statistics on update messages in a specified data table of a specified instance.
 *
 * @param request QueryDataMessageStatisticsRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryDataMessageStatisticsResponse
 */
async function queryDataMessageStatisticsWithOptions(instanceId: string, table: string, request: QueryDataMessageStatisticsRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryDataMessageStatisticsResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.bhvType)) {
    query['bhvType'] = request.bhvType;
  }
  if (!Util.isUnset(request.cmdType)) {
    query['cmdType'] = request.cmdType;
  }
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.imei)) {
    query['imei'] = request.imei;
  }
  if (!Util.isUnset(request.itemId)) {
    query['itemId'] = request.itemId;
  }
  if (!Util.isUnset(request.itemType)) {
    query['itemType'] = request.itemType;
  }
  if (!Util.isUnset(request.messageSource)) {
    query['messageSource'] = request.messageSource;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.traceId)) {
    query['traceId'] = request.traceId;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['userType'] = request.userType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryDataMessageStatistics',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/tables/${OpenApiUtil.getEncodeParam(table)}/data-message-statistics`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries statistics on update messages in a data table of an instance.
 *
 * @description You can call this API operation to query statistics on update messages in a specified data table of a specified instance.
 *
 * @param request QueryDataMessageStatisticsRequest
 * @return QueryDataMessageStatisticsResponse
 */
async function queryDataMessageStatistics(instanceId: string, table: string, request: QueryDataMessageStatisticsRequest): QueryDataMessageStatisticsResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryDataMessageStatisticsWithOptions(instanceId, table, request, headers, runtime);
}

model QueryExceptionHistoryRequest {
  endTime?: long(name='endTime', description='This parameter is required.', example='1586673466'),
  startTime?: long(name='startTime', description='This parameter is required.', example='1586673466'),
  type?: string(name='type', description='This parameter is required.'),
}

model QueryExceptionHistoryResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result'),
}

model QueryExceptionHistoryResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryExceptionHistoryResponseBody(name='body'),
}

/**
 * @param request QueryExceptionHistoryRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryExceptionHistoryResponse
 */
async function queryExceptionHistoryWithOptions(instanceId: string, request: QueryExceptionHistoryRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryExceptionHistoryResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }
  if (!Util.isUnset(request.type)) {
    query['type'] = request.type;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryExceptionHistory',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/sync-reports/exception-history`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @param request QueryExceptionHistoryRequest
 * @return QueryExceptionHistoryResponse
 */
async function queryExceptionHistory(instanceId: string, request: QueryExceptionHistoryRequest): QueryExceptionHistoryResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryExceptionHistoryWithOptions(instanceId, request, headers, runtime);
}

model QueryRawDataRequest {
  imei?: string(name='imei'),
  itemId?: string(name='itemId', description='The item ID. This parameter is required when the table parameter is set to item.', example='112'),
  itemType?: string(name='itemType', description='The type of the item. This parameter is required when the table parameter is set to item.', example='video'),
  userId?: string(name='userId', description='The user ID. This parameter is required when the table parameter is set to user.', example='111'),
  userType?: string(name='userType', description='The type of the user. This parameter is required when the table parameter is set to user.', example='app'),
}

model QueryRawDataResponseBody = {
  message?: string(name='Message', description='The error message.', example='An internal server error occurred'),
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result', description='The returned result.', example='xxx'),
}

model QueryRawDataResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QueryRawDataResponseBody(name='body'),
}

/**
 * @summary Queries raw data in a specific data table of an instance by using the primary key.
 *
 * @description You can call this operation to query raw data in a specific data table of an instance by using the primary key. The returned results need to be confirmed by customers.
 *
 * @param request QueryRawDataRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QueryRawDataResponse
 */
async function queryRawDataWithOptions(instanceId: string, table: string, request: QueryRawDataRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QueryRawDataResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.imei)) {
    query['imei'] = request.imei;
  }
  if (!Util.isUnset(request.itemId)) {
    query['itemId'] = request.itemId;
  }
  if (!Util.isUnset(request.itemType)) {
    query['itemType'] = request.itemType;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  if (!Util.isUnset(request.userType)) {
    query['userType'] = request.userType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QueryRawData',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/tables/${OpenApiUtil.getEncodeParam(table)}/raw-data`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries raw data in a specific data table of an instance by using the primary key.
 *
 * @description You can call this operation to query raw data in a specific data table of an instance by using the primary key. The returned results need to be confirmed by customers.
 *
 * @param request QueryRawDataRequest
 * @return QueryRawDataResponse
 */
async function queryRawData(instanceId: string, table: string, request: QueryRawDataRequest): QueryRawDataResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return queryRawDataWithOptions(instanceId, table, request, headers, runtime);
}

model QuerySingleAggregationReportResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result'),
}

model QuerySingleAggregationReportResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QuerySingleAggregationReportResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QuerySingleAggregationReportResponse
 */
async function querySingleAggregationReportWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySingleAggregationReportResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'QuerySingleAggregationReport',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/sync-reports/single-aggregation-report`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return QuerySingleAggregationReportResponse
 */
async function querySingleAggregationReport(instanceId: string): QuerySingleAggregationReportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySingleAggregationReportWithOptions(instanceId, headers, runtime);
}

model QuerySingleReportRequest {
  reportType?: string(name='reportType', description='The type of the single table report. This parameter is required.

Valid values: typeItemValidScene,

typeItemTag,

typeItemTagScene,

typeItemWeightScene,

typeItemRawScene, and

typeItemExpireScene

This parameter is required.', example='typeItemTagScene'),
}

model QuerySingleReportResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the request.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result', description='The returned result.', example='xxx'),
}

model QuerySingleReportResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QuerySingleReportResponseBody(name='body'),
}

/**
 * @summary Queries a single table report. More report types may be supported.
 *
 * @param request QuerySingleReportRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QuerySingleReportResponse
 */
async function querySingleReportWithOptions(instanceId: string, request: QuerySingleReportRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySingleReportResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.reportType)) {
    query['reportType'] = request.reportType;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySingleReport',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/sync-reports/single-report`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries a single table report. More report types may be supported.
 *
 * @param request QuerySingleReportRequest
 * @return QuerySingleReportResponse
 */
async function querySingleReport(instanceId: string, request: QuerySingleReportRequest): QuerySingleReportResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySingleReportWithOptions(instanceId, request, headers, runtime);
}

model QuerySyncReportAggregationRequest {
  endTime?: long(name='endTime', description='The end time. The value is a timestamp in seconds.

This parameter is required.', example='1586673466'),
  startTime?: long(name='startTime', description='The start time. The value is a timestamp in seconds.

This parameter is required.', example='1586673466'),
}

model QuerySyncReportAggregationResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the request.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: map[string]any(name='result', description='The returned results.', example='xxx'),
}

model QuerySyncReportAggregationResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: QuerySyncReportAggregationResponseBody(name='body'),
}

/**
 * @summary Queries the data overview.
 *
 * @param request QuerySyncReportAggregationRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return QuerySyncReportAggregationResponse
 */
async function querySyncReportAggregationWithOptions(instanceId: string, request: QuerySyncReportAggregationRequest, headers: map[string]string, runtime: Util.RuntimeOptions): QuerySyncReportAggregationResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.endTime)) {
    query['endTime'] = request.endTime;
  }
  if (!Util.isUnset(request.startTime)) {
    query['startTime'] = request.startTime;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'QuerySyncReportAggregation',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/sync-reports/aggregation`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Queries the data overview.
 *
 * @param request QuerySyncReportAggregationRequest
 * @return QuerySyncReportAggregationResponse
 */
async function querySyncReportAggregation(instanceId: string, request: QuerySyncReportAggregationRequest): QuerySyncReportAggregationResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return querySyncReportAggregationWithOptions(instanceId, request, headers, runtime);
}

model RebuildIndexResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: string(name='result', description='The returned result.', example='true'),
}

model RebuildIndexResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RebuildIndexResponseBody(name='body'),
}

/**
 * @summary Rebuilds an index.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RebuildIndexResponse
 */
async function rebuildIndexWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RebuildIndexResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RebuildIndex',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/actions/rebuild`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Rebuilds an index.
 *
 * @return RebuildIndexResponse
 */
async function rebuildIndex(instanceId: string, algorithmId: string): RebuildIndexResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return rebuildIndexWithOptions(instanceId, algorithmId, headers, runtime);
}

model RecommendRequest {
  filter?: string(name='filter', description='The status of the execution.', example='eyJqb2luIjoiYW5kIiwiZmlsdGVycyI6W3siY29uZCI6ImNvbnRhaW4iLCJmaWVsZCI6InRhZ3MiLCJ2YWx1ZSI6IuWPjOS6uiJ9XX0.'),
  imei?: string(name='imei', description='The ID of the scene in which the item is to be recommended.', example='06e1565409c9fc4887036b974421****'),
  ip?: string(name='ip', description='The HTTP status code.', example='192.168.1.1'),
  items?: string(name='items', description='The information about event tracking. The value of this parameter varies based on different items and needs to be uploaded together with the corresponding behavior data.', example='1001'),
  rankOpen?: boolean(name='rankOpen', description='N/A', example='true'),
  recType?: string(name='recType', description='The type of the recommended item.', example='gul'),
  returnCount?: int32(name='returnCount', description='The returned results.

This parameter is required.', example='10'),
  sceneId?: string(name='sceneId', description='The number of result entries to return. Valid values: 0 to 50.', example='test'),
  serviceType?: string(name='serviceType', description='The position at which the recommended item is displayed. The position number starts from 0. The return results are ranked by position. You can ignore this parameter.', example='1'),
  strategy?: string(name='strategy', description='如果需要使用坑位策略，请求参数内新增strategy="fixedSlot"，此时系统将按照坑位配置返回推荐结果', example='fixedSlot'),
  userId?: string(name='userId', description='The items used for related recommendations in specified scenes.', example='123'),
  userInfo?: string(name='userInfo', description='The ID of the request.', example='1'),
}

model RecommendResponseBody = {
  code?: string(name='code', description='This parameter may be used in the debugging process. You can ignore this parameter.', example='200'),
  message?: string(name='message', description='Queries the recommendation results of a specified instance.', example='"i2i_common_common;NotFound;1673254401;similar product/content of clicked ones;2023-01-09 16:53:21"'),
  requestId?: string(name='requestId', description='The weight of the specified process.', example='04707E49-642A-4649-827A-F8EEB07D4C27'),
  result?: [ 
    {
      flowWeight?: double(name='flowWeight', description='The ID of the device.', example='0'),
      itemId?: string(name='itemId', description='The returned results.', example='123'),
      itemType?: string(name='itemType', description='The ID of the recommended item.', example='item'),
      matchInfo?: string(name='matchInfo', description='N/A', example='xxx'),
      message?: string(name='message', description='The event tracking ID. This parameter is uploaded together with user behaviors on the recommended item. In this case, the value of this parameter is ali.', example='Successful'),
      position?: int32(name='position', description='The string for filtering during recommendation.', example='1'),
      traceId?: string(name='traceId', description='The status of the execution.', example='ali'),
      traceInfo?: string(name='traceInfo', description='Specifies whether to perform personalized ranking based on the user IDs in the filtering and ranking phases.', example='"1007.62381.131491.100200300000000:bcb946ed-3f09-4e9b-bf4a-c19862f42231:792783::0:s101:::15:content___130788_stall:item:i2i_common_common:0.0205279946753756:null:null:1673258031504::context__recall_index=156,context__hour=17,context__trigger_num=2::C7EF99C9-6C55-5D45-A8D5-0754082E9DCF:hot_common,i2i_common_common,i2i_swing_common,hot_full:::::"'),
      weight?: float(name='weight', description='The weight of the recommended item.', example='1'),
    }
  ](name='result', description='The unique ID of the user.'),
}

model RecommendResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RecommendResponseBody(name='body'),
}

/**
 * @summary The type of the recommendation service.
 *
 * @param request RecommendRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RecommendResponse
 */
async function recommendWithOptions(instanceId: string, request: RecommendRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RecommendResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.filter)) {
    query['filter'] = request.filter;
  }
  if (!Util.isUnset(request.imei)) {
    query['imei'] = request.imei;
  }
  if (!Util.isUnset(request.ip)) {
    query['ip'] = request.ip;
  }
  if (!Util.isUnset(request.items)) {
    query['items'] = request.items;
  }
  if (!Util.isUnset(request.rankOpen)) {
    query['rankOpen'] = request.rankOpen;
  }
  if (!Util.isUnset(request.recType)) {
    query['recType'] = request.recType;
  }
  if (!Util.isUnset(request.returnCount)) {
    query['returnCount'] = request.returnCount;
  }
  if (!Util.isUnset(request.sceneId)) {
    query['sceneId'] = request.sceneId;
  }
  if (!Util.isUnset(request.serviceType)) {
    query['serviceType'] = request.serviceType;
  }
  if (!Util.isUnset(request.strategy)) {
    query['strategy'] = request.strategy;
  }
  if (!Util.isUnset(request.userId)) {
    query['userId'] = request.userId;
  }
  if (!Util.isUnset(request.userInfo)) {
    query['userInfo'] = request.userInfo;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'Recommend',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/actions/recommend`,
    method = 'GET',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary The type of the recommendation service.
 *
 * @param request RecommendRequest
 * @return RecommendResponse
 */
async function recommend(instanceId: string, request: RecommendRequest): RecommendResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return recommendWithOptions(instanceId, request, headers, runtime);
}

model RefreshFeatureTableResponseBody = {
  requestId?: string(name='requestId', example='8B90B646-1678-41A3-B23F-EAC6587B0E48'),
  result?: FeatureTable(name='result'),
}

model RefreshFeatureTableResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RefreshFeatureTableResponseBody(name='body'),
}

/**
 * @summary Refreshes a feature table based on the source table in MaxCompute. The refresh policy is subject to data in the source table.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RefreshFeatureTableResponse
 */
async function refreshFeatureTableWithOptions(instanceId: string, type: string, featureTableId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RefreshFeatureTableResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RefreshFeatureTable',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/feature-tables/${OpenApiUtil.getEncodeParam(type)}/${OpenApiUtil.getEncodeParam(featureTableId)}/actions/refresh`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Refreshes a feature table based on the source table in MaxCompute. The refresh policy is subject to data in the source table.
 *
 * @return RefreshFeatureTableResponse
 */
async function refreshFeatureTable(instanceId: string, type: string, featureTableId: string): RefreshFeatureTableResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return refreshFeatureTableWithOptions(instanceId, type, featureTableId, headers, runtime);
}

model RollbackRankingSystemRequest {
  body?: map[string]any(name='body', example='{
	"operateId": "a-b-c"
}'),
}

model RollbackRankingSystemResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: map[string]any(name='result'),
}

model RollbackRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RollbackRankingSystemResponseBody(name='body'),
}

/**
 * @summary 回滚某个排序服务
 *
 * @param request RollbackRankingSystemRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RollbackRankingSystemResponse
 */
async function rollbackRankingSystemWithOptions(instanceId: string, name: string, request: RollbackRankingSystemRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RollbackRankingSystemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'RollbackRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}/actions/rollback`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 回滚某个排序服务
 *
 * @param request RollbackRankingSystemRequest
 * @return RollbackRankingSystemResponse
 */
async function rollbackRankingSystem(instanceId: string, name: string, request: RollbackRankingSystemRequest): RollbackRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return rollbackRankingSystemWithOptions(instanceId, name, request, headers, runtime);
}

model RunInstanceResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The request ID.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: boolean(name='result', description='Indicates whether a dataset was created.', example='false'),
}

model RunInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunInstanceResponseBody(name='body'),
}

/**
 * @summary Runs an instance to start a full data import task.
 *
 * @description You can call this API operation to run an instance to start a full data import task. After you call this API operation, the system creates a dataset. Then, the system imports all data from your data sources into the dataset for data training.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunInstanceResponse
 */
async function runInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RunInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RunInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/actions/import`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Runs an instance to start a full data import task.
 *
 * @description You can call this API operation to run an instance to start a full data import task. After you call this API operation, the system creates a dataset. Then, the system imports all data from your data sources into the dataset for data training.
 *
 * @return RunInstanceResponse
 */
async function runInstance(instanceId: string): RunInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runInstanceWithOptions(instanceId, headers, runtime);
}

model RunRankingModelTemplateResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: map[string]any(name='result', example='xxx'),
}

model RunRankingModelTemplateResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunRankingModelTemplateResponseBody(name='body'),
}

/**
 * @summary 启动模型训练
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunRankingModelTemplateResponse
 */
async function runRankingModelTemplateWithOptions(instanceId: string, templateId: string, headers: map[string]string, runtime: Util.RuntimeOptions): RunRankingModelTemplateResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'RunRankingModelTemplate',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-model-templates/${OpenApiUtil.getEncodeParam(templateId)}/actions/run`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 启动模型训练
 *
 * @return RunRankingModelTemplateResponse
 */
async function runRankingModelTemplate(instanceId: string, templateId: string): RunRankingModelTemplateResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runRankingModelTemplateWithOptions(instanceId, templateId, headers, runtime);
}

model RunSampleFormatConfigRequest {
  mode?: string(name='mode', description='The mode of the formatting. Default value: Latest. This value indicates that the latest formatting configurations are used.', example='latest'),
}

model RunSampleFormatConfigResponseBody = {
  requestId?: string(name='requestId', description='The instance ID.', example='airec-test'),
  result?: boolean(name='result', description='Indicates whether the sample formatting configurations are triggered.', example='true'),
}

model RunSampleFormatConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: RunSampleFormatConfigResponseBody(name='body'),
}

/**
 * @summary Triggers sample formatting configurations.
 *
 * @param request RunSampleFormatConfigRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return RunSampleFormatConfigResponse
 */
async function runSampleFormatConfigWithOptions(instanceId: string, sampleId: string, request: RunSampleFormatConfigRequest, headers: map[string]string, runtime: Util.RuntimeOptions): RunSampleFormatConfigResponse {
  Util.validateModel(request);
  var query : map[string]any = {};
  if (!Util.isUnset(request.mode)) {
    query['mode'] = request.mode;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'RunSampleFormatConfig',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/samples/${OpenApiUtil.getEncodeParam(sampleId)}/format-configs/actions/run`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Triggers sample formatting configurations.
 *
 * @param request RunSampleFormatConfigRequest
 * @return RunSampleFormatConfigResponse
 */
async function runSampleFormatConfig(instanceId: string, sampleId: string, request: RunSampleFormatConfigRequest): RunSampleFormatConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return runSampleFormatConfigWithOptions(instanceId, sampleId, request, headers, runtime);
}

model StopDataSetResponseBody = {
  code?: string(name='code', example='InternalServerError'),
  message?: string(name='message', example='An internal server error occurred'),
  requestId?: string(name='requestId', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    gmtCreate?: long(name='gmtCreate', example='1544112000000'),
    gmtModified?: long(name='gmtModified', example='1544112000000'),
    instanceId?: string(name='instanceId', example='airec-cn-o400whm78004'),
    state?: string(name='state', example='Importing'),
    versionId?: string(name='versionId', example='20181023214546'),
  }(name='result'),
}

model StopDataSetResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopDataSetResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopDataSetResponse
 */
async function stopDataSetWithOptions(instanceId: string, versionId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StopDataSetResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StopDataSet',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/dataSets/${OpenApiUtil.getEncodeParam(versionId)}/actions/stop`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return StopDataSetResponse
 */
async function stopDataSet(instanceId: string, versionId: string): StopDataSetResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopDataSetWithOptions(instanceId, versionId, headers, runtime);
}

model StopFlowControlTaskResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: boolean(name='result', example='true'),
}

model StopFlowControlTaskResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: StopFlowControlTaskResponseBody(name='body'),
}

/**
 * @summary 停止流调任务接口
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return StopFlowControlTaskResponse
 */
async function stopFlowControlTaskWithOptions(instanceId: string, taskId: string, headers: map[string]string, runtime: Util.RuntimeOptions): StopFlowControlTaskResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'StopFlowControlTask',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/flowControlTasks/${OpenApiUtil.getEncodeParam(taskId)}/actions/stop`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 停止流调任务接口
 *
 * @return StopFlowControlTaskResponse
 */
async function stopFlowControlTask(instanceId: string, taskId: string): StopFlowControlTaskResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return stopFlowControlTaskWithOptions(instanceId, taskId, headers, runtime);
}

model UnLockIndexVersionResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: boolean(name='result', example='true'),
}

model UnLockIndexVersionResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UnLockIndexVersionResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UnLockIndexVersionResponse
 */
async function unLockIndexVersionWithOptions(instanceId: string, algorithmId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UnLockIndexVersionResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UnLockIndexVersion',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/filtering-algorithms/${OpenApiUtil.getEncodeParam(algorithmId)}/actions/unlock`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return UnLockIndexVersionResponse
 */
async function unLockIndexVersion(instanceId: string, algorithmId: string): UnLockIndexVersionResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return unLockIndexVersionWithOptions(instanceId, algorithmId, headers, runtime);
}

model UpdateExperimentBasicInfoResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: {
    algorithms?: [ 
      {
        category?: string(name='category', description='The category of the algorithm.', example='2'),
        config?: [ 
          {
            defaultValue?: string(name='defaultValue', description='The default value of the algorithm configuration item.', example='true'),
            experimentValue?: string(name='experimentValue', description='The custom value of the algorithm configuration item.', example='400'),
            key?: string(name='key', description='The key of the algorithm configuration item.', example='I2I'),
            name?: string(name='name', description='The name of the algorithm configuration item.', example='I2I filtering algorithm'),
          }
        ](name='config', description='The information about the child configuration item.'),
        defaultValue?: string(name='defaultValue', description='The default value of the algorithm.', example='400'),
        experimentValue?: string(name='experimentValue', description='The custom value of the algorithm.', example='400'),
        hasConfig?: boolean(name='hasConfig', description='Indicates whether child configuration items exist. Valid values: true and false.', example='false'),
        key?: string(name='key', description='The key of the algorithm.', example='I2I'),
        name?: string(name='name', description='The name of the experiment.', example='test'),
        type?: string(name='type', description='The type of the algorithm.', example='SYSTEM'),
      }
    ](name='algorithms', description='The parameters of the experiment.'),
    base?: boolean(name='base', description='Indicates whether the experiment uses default configurations.', example='true'),
    buckets?: [ string ](name='buckets', description='The traffic buckets.'),
    description?: string(name='description', description='The description of the experiment.', example='demo1'),
    experimentId?: string(name='experimentId', description='The experiment ID.', example='12345'),
    name?: string(name='name', description='The name of the experiment.', example='test'),
    offlineTime?: string(name='offlineTime', description='The time when the experiment was unpublished.', example='2020-11-11T09:47:43.000Z'),
    onlineTime?: string(name='onlineTime', description='The time when the experiment was published.', example='2020-11-11T09:47:43.000Z'),
    status?: string(name='status', description='The status of the experiment.', example='1'),
  }(name='result', description='The information about the experiment.'),
}

model UpdateExperimentBasicInfoResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateExperimentBasicInfoResponseBody(name='body'),
}

/**
 * @summary Updates the basic information about an experiment.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateExperimentBasicInfoResponse
 */
async function updateExperimentBasicInfoWithOptions(instanceId: string, sceneId: string, experimentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateExperimentBasicInfoResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UpdateExperimentBasicInfo',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments/${OpenApiUtil.getEncodeParam(experimentId)}/basic`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the basic information about an experiment.
 *
 * @return UpdateExperimentBasicInfoResponse
 */
async function updateExperimentBasicInfo(instanceId: string, sceneId: string, experimentId: string): UpdateExperimentBasicInfoResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateExperimentBasicInfoWithOptions(instanceId, sceneId, experimentId, headers, runtime);
}

model UpdateExperimentConfigResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: {
    algorithms?: [ 
      {
        category?: string(name='category', example='RECALL'),
        config?: [ 
          {
            defaultValue?: string(name='defaultValue', example='true'),
            experimentValue?: string(name='experimentValue', example='true'),
            key?: string(name='key', example='I2I'),
            name?: string(name='name', example='xxx'),
          }
        ](name='config'),
        defaultValue?: string(name='defaultValue', example='400'),
        experimentValue?: string(name='experimentValue', example='300'),
        hasConfig?: boolean(name='hasConfig', example='true'),
        key?: string(name='key', example='I2I'),
        name?: string(name='name', example='xxx'),
        type?: string(name='type', example='SYSTEM'),
      }
    ](name='algorithms'),
    base?: boolean(name='base', example='true'),
    buckets?: [ string ](name='buckets'),
    description?: string(name='description', example='demo1'),
    experimentId?: string(name='experimentId', example='xxx'),
    name?: string(name='name'),
    offlineTime?: string(name='offlineTime', example='2020-12-07T06:47:30.000Z'),
    onlineTime?: string(name='onlineTime', example='2020-12-07T06:47:30.000Z'),
    status?: string(name='status', example='Online'),
  }(name='result'),
}

model UpdateExperimentConfigResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateExperimentConfigResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateExperimentConfigResponse
 */
async function updateExperimentConfigWithOptions(instanceId: string, sceneId: string, experimentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateExperimentConfigResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UpdateExperimentConfig',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments/${OpenApiUtil.getEncodeParam(experimentId)}/config`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return UpdateExperimentConfigResponse
 */
async function updateExperimentConfig(instanceId: string, sceneId: string, experimentId: string): UpdateExperimentConfigResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateExperimentConfigWithOptions(instanceId, sceneId, experimentId, headers, runtime);
}

model UpdateExperimentStatusResponseBody = {
  requestId?: string(name='requestId', description='The request ID.', example='E3D6FE3B-B7C2-43DA-9A13-5EA837ACED9B'),
  result?: {
    algorithms?: [ 
      {
        category?: string(name='category', description='The algorithm category. Valid values: RECALL and RANK.', example='RECALL'),
        config?: [ 
          {
            defaultValue?: string(name='defaultValue', description='The default value of the algorithm. If you set key to i2i, hot, or new, the value of this parameter is true or false. If you set key to mtorder, the value of this parameter is a list of filtering algorithms ranked by priority.', example='xxx'),
            experimentValue?: string(name='experimentValue', description='The custom value of the algorithm.', example='xxx'),
            key?: string(name='key', description='The algorithm key. Valid values: i2i: the I2I filtering algorithm. u2x2i: the U2X2I filtering algorithm. hot: the filtering algorithm for popular items. new: the filtering algorithm for new items. embedding: the vector filtering algorithm. mtorder: the priority of the filtering algorithm. rankservice: the ranking service.', example='hot'),
            name?: string(name='name', description='The algorithm name. (Note: If you use the default algorithm, the console obtains the algorithm name from Medusa. If you customize an algorithm for the experiment, the algorithm name is directly returned.)', example='xxx'),
          }
        ](name='config', description='The experiment configurations.'),
        defaultValue?: string(name='defaultValue', description='The default value of the algorithm configuration item.', example='swing'),
        experimentValue?: string(name='experimentValue', description='The custom value of the algorithm configuration item.', example='xxx'),
        hasConfig?: boolean(name='hasConfig', description='Indicates whether child configuration items exist. Valid values: true and false.', example='false'),
        key?: string(name='key', description='The algorithm key. Valid values: i2i: the I2I filtering algorithm. u2x2i: the U2X2I filtering algorithm. hot: the filtering algorithm for popular items. new: the filtering algorithm for new items. embedding: the vector filtering algorithm. mtorder: the priority of the filtering algorithm. rankservice: the ranking service.', example='hot'),
        name?: string(name='name', description='The algorithm name. (Note: If you use the default algorithm, the console obtains the algorithm name from Medusa. If you customize an algorithm for the experiment, the algorithm name is directly returned.)', example='xxx'),
        type?: string(name='type', description='The algorithm type. Valid values: SYSTEM and CUSTOM.', example='SYSTEM'),
      }
    ](name='algorithms', description='The algorithm configurations.'),
    base?: boolean(name='base', description='Indicates whether the default configurations are used for the experiment.', example='true'),
    buckets?: [ string ](name='buckets', description='The buckets. This parameter takes effect only when the experiment is published.'),
    description?: string(name='description', description='The remarks of the experiment.', example='xxx'),
    experimentId?: string(name='experimentId', description='The experiment ID.', example='123'),
    name?: string(name='name', description='The experiment name.', example='test'),
    offlineTime?: string(name='offlineTime', description='The time when the experiment was unpublished.', example='2020-11-11T09:47:43.000Z'),
    onlineTime?: string(name='onlineTime', description='The time when the experiment was published.', example='2020-11-11T09:47:43.000Z'),
    status?: string(name='status', description='The experiment state. Valid values: init, online, finish, and offline.', example='init'),
  }(name='result', description='The returned result.'),
}

model UpdateExperimentStatusResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpdateExperimentStatusResponseBody(name='body'),
}

/**
 * @summary Updates the state of an experiment.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpdateExperimentStatusResponse
 */
async function updateExperimentStatusWithOptions(instanceId: string, sceneId: string, experimentId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UpdateExperimentStatusResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UpdateExperimentStatus',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/scenes/${OpenApiUtil.getEncodeParam(sceneId)}/experiments/${OpenApiUtil.getEncodeParam(experimentId)}/status`,
    method = 'PUT',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Updates the state of an experiment.
 *
 * @return UpdateExperimentStatusResponse
 */
async function updateExperimentStatus(instanceId: string, sceneId: string, experimentId: string): UpdateExperimentStatusResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return updateExperimentStatusWithOptions(instanceId, sceneId, experimentId, headers, runtime);
}

model UpgradeInstanceResponseBody = {
  code?: string(name='code', description='The error code.', example='InternalServerError'),
  message?: string(name='message', description='The error message.', example='An internal server error occurred'),
  requestId?: string(name='requestId', description='The ID of the request.', example='8F81A922-6C81-46D6-B78C-CC35E16B1691'),
  result?: {
    instanceId?: string(name='instanceId', description='The ID of the instance.', example='airec-cn-o400whm78004'),
  }(name='result', description='The returned results.'),
}

model UpgradeInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: UpgradeInstanceResponseBody(name='body'),
}

/**
 * @summary Modifies the quotas of a specified instance.
 *
 * @description You can call this operation to modify the quotas of a specified instance.
 * The limits on the number of users: 1,000,000 to 10,000,000. The limits on the number of items: 1,000,000 to 10,000,000. The limits on the queries per second (QPS) for recommendation requests: 10 to 500.
 *
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return UpgradeInstanceResponse
 */
async function upgradeInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): UpgradeInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'UpgradeInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/actions/upgrade`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary Modifies the quotas of a specified instance.
 *
 * @description You can call this operation to modify the quotas of a specified instance.
 * The limits on the number of users: 1,000,000 to 10,000,000. The limits on the number of items: 1,000,000 to 10,000,000. The limits on the queries per second (QPS) for recommendation requests: 10 to 500.
 *
 * @return UpgradeInstanceResponse
 */
async function upgradeInstance(instanceId: string): UpgradeInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return upgradeInstanceWithOptions(instanceId, headers, runtime);
}

model ValidateInstanceResponseBody = {
  code?: string(name='code'),
  message?: string(name='message'),
  requestId?: string(name='requestId', example='90D6B8F5-FE97-4509-9AAB-367836C51818'),
  result?: boolean(name='result', example='true'),
}

model ValidateInstanceResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: ValidateInstanceResponseBody(name='body'),
}

/**
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return ValidateInstanceResponse
 */
async function validateInstanceWithOptions(instanceId: string, headers: map[string]string, runtime: Util.RuntimeOptions): ValidateInstanceResponse {
  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
  };
  var params = new OpenApi.Params{
    action = 'ValidateInstance',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/actions/validate`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @return ValidateInstanceResponse
 */
async function validateInstance(instanceId: string): ValidateInstanceResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return validateInstanceWithOptions(instanceId, headers, runtime);
}

model VerifyRankingSystemRequest {
  body?: map[string]any(name='body', example='{
  "userFeatures": "a:c,d:b",
  "itemFeatures": "a:1,b:2"
}'),
}

model VerifyRankingSystemResponseBody = {
  requestId?: string(name='requestId', example='829F38F6-E2D6-4109-90A6-888160BD16C2'),
  result?: string(name='result', example='test'),
}

model VerifyRankingSystemResponse = {
  headers?: map[string]string(name='headers'),
  statusCode?: int32(name='statusCode'),
  body?: VerifyRankingSystemResponseBody(name='body'),
}

/**
 * @summary 调试排序服务
 *
 * @param request VerifyRankingSystemRequest
 * @param headers map
 * @param runtime runtime options for this request RuntimeOptions
 * @return VerifyRankingSystemResponse
 */
async function verifyRankingSystemWithOptions(instanceId: string, name: string, request: VerifyRankingSystemRequest, headers: map[string]string, runtime: Util.RuntimeOptions): VerifyRankingSystemResponse {
  Util.validateModel(request);
  var body : map[string]any = {};
  if (!Util.isUnset(request.body)) {
    body['body'] = request.body;
  }

  var req = new OpenApi.OpenApiRequest{ 
    headers = headers,
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'VerifyRankingSystem',
    version = '2020-11-26',
    protocol = 'HTTPS',
    pathname = `/v2/openapi/instances/${OpenApiUtil.getEncodeParam(instanceId)}/ranking-systems/${OpenApiUtil.getEncodeParam(name)}/actions/verify`,
    method = 'POST',
    authType = 'AK',
    style = 'ROA',
    reqBodyType = 'json',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

/**
 * @summary 调试排序服务
 *
 * @param request VerifyRankingSystemRequest
 * @return VerifyRankingSystemResponse
 */
async function verifyRankingSystem(instanceId: string, name: string, request: VerifyRankingSystemRequest): VerifyRankingSystemResponse {
  var runtime = new Util.RuntimeOptions{};
  var headers : map[string]string = {};
  return verifyRankingSystemWithOptions(instanceId, name, request, headers, runtime);
}

